cxxomfort
rel.20211024
Simple backports for C++ - https://ryan.gulix.cl/fossil.cgi/cxxomfort/
|
Implementation of swap_if proposal. More...
Namespaces | |
cxxomfort | |
Namespace of the cxxomfort library. | |
Functions | |
template<typename T > | |
bool | swap_if (bool c, T &a, T &b) |
Conditionally swaps elements avoiding a branch if possible. More... | |
Implementation of swap_if proposal.
bool cxxomfort::impl::swap_if | ( | bool | c, |
T & | a, | ||
T & | b | ||
) |
Conditionally swaps elements avoiding a branch if possible.
Given (movable) objects a and b , swap_if()
will swap them if the condition c holds , avoiding a branch (if
) where possible.
Referenced by cxxomfort::impl::swap_if().