...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
template <class T>
struct is_swappable : public true_type-or-false_type
{};
Inherits: If the expression swap(declval<T&>(),
declval<T&>())
(in a context where std::swap
is visible) is valid, inherits from
true_type,
otherwise from false_type.
Compiler Compatibility: This trait requires C++11 for full support. On C++03 compilers it will inherit from true_type for scalar types (including integral, floating point, enumeration, pointer and pointer-to-member types) and from false_type for anything else. If MSVC standard library is used, C++17 is required for full support. In this case, in C++11 and C++14 modes the trait will inherit from true_type for types that support move construction and move assignment and from false_type for other types.
Header: #include
<boost/type_traits/is_swappable.hpp>
or #include <boost/type_traits.hpp>