![]() |
Arene Base
Fundamental Utilities For Safety Critical C++
|
|
staticconstexpr |
A Customization Point Object implementation of the constexpr compatible std::swap from C++17.
| T | type of the elements to swap. |
| lhs | element(s) to swap. |
| rhs | element(s) to swap. |
lhs and rhs will have had their states exchanged by one of the described methods.Functionally equivalent to std::swap , including support for c-arrays. Unlike std::swap , arene::base::swap is implemented as a Customization Point Object. This means it has the following properties:
swap customizations automatically. Customizations are given the following preference:swap(lhs,rhs) , if it exists.std::swap .arene::base which provide customizations of swap .This allow simplification of user code. When using std::swap in a generic context, best practice requires the following pattern in order to allow ADL discovery of swap customizations while falling back to the generic for the default case:std::swap implementation
This is easy to forget. With arene::base::swap , this becomes simply: