Open robertapplin opened 2 years ago
This issue has been automatically marked as stale because it has not had activity in 6 months. It will be closed in 7 days if no further activity occurs. Allowing issues to close as stale helps us filter out issues which can wait for future development time. All issues closed by stale bot act like normal issues; they can be searched for, commented on or reopened at any point. If you'd like a closed stale issue to be considered, feel free to either re-open the issue directly or contact a developer. To extend the lifetime of an issue please comment below, it helps us see that this is still affecting you and you want it fixed in the near-future. Extending the lifetime of an issue may cause the development team to prioritise it over other issues, which may be closed as stale instead.
This issue has been automatically marked as stale because it has not had activity in 6 months. It will be closed in 7 days if no further activity occurs. Allowing issues to close as stale helps us filter out issues which can wait for future development time. All issues closed by stale bot act like normal issues; they can be searched for, commented on or reopened at any point. If you'd like a closed stale issue to be considered, feel free to either re-open the issue directly or contact a developer. To extend the lifetime of an issue please comment below, it helps us see that this is still affecting you and you want it fixed in the near-future. Extending the lifetime of an issue may cause the development team to prioritise it over other issues, which may be closed as stale instead.
Universal/Forwarding References
l-value
(locator value) is a value found at a memory location.pr-value
(pure r-value) is all literals except strings, often seen on the rhs of an expression.x-value
(exclusive value) is an expiring value likestd::move(s)="Hello"
.const value
can sometimes cause a copy operation, as is not the case when returning byvalue
. This is for the same reason you might create a constructor that has arguments taken by value (i.e. prevents copy for pr-values and instead does a move).std::move(x) = static_cast<T &&>(x)
decltype(auto)
can be used as the return value for perfect returningA Practical Approach to Error Handling
noexcept
whenever possible when not expecting an exceptionassert
(to ensure you stay on a narrow path). Never terminate if an assertion fails, as the assertion might be wrong (due to human error or assumptions). The assumptions made by a developer are also documented when it comes to trying to fix a problem caused by an assertion.Aliasing
restrict
keyword tells the compiler that aliasing is undefined behaviour.Replacing Legacy Systems - Keys to success
TODO
Code smells
https://sourcemaking.com/refactoring/smells
Other
shared_ptr
due to locking considerations, unless using ashared_ptr<const T>
.using
statement.std::optional
,std::span
, cpp20requires
, pipe operator used frequently with cpp20 views and ranges.