is_swappable¶
Header¶
#include <tick/traits/is_swappable.h>
Description¶
Checks if type T
can be called with either std::swap
or an ADL
overload of swap
.
Requirements¶
Type U
is swappable with type T
if, for any object u
of type U
and
any object t
of type T
Expression | Requirements |
---|---|
using std::swap; swap(t, u); |
After the call, the value of t is the value held by u before the call, and the value of u is the value held by t before the call. |
using std::swap; swap(u, t); |
After the call, the value of t is the value held by u before the call, and the value of u is the value held by t before the call. |
Synopsis¶
TICK_TRAIT(is_swappable)
{
using std::swap;
template<class T>
auto require(T&& x) -> valid<
decltype(swap(x, x))
>;
template<class T, class U>
auto require(T&& x, U&& y) -> valid<
decltype(swap(x, y))
decltype(swap(y, x))
>;
};