Added is_swappable(_with) traits.

This commit is contained in:
Andrey Semashev
2023-02-18 19:56:56 +03:00
parent 1c31fee575
commit fc61f298bf
8 changed files with 381 additions and 9 deletions

View File

@ -1,4 +1,4 @@
[/
[/
Copyright 2009 John Maddock.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
@ -7,6 +7,10 @@
[section:history History]
[h4 Boost-1.82.0]
* Added __is_swappable trait.
[h4 Boost-1.70.0]
* Added new traits __is_bounded_array, __is_unbounded_array, __copy_reference, __copy_cv_ref.

26
doc/is_swappable.qbk Normal file
View File

@ -0,0 +1,26 @@
[/
Copyright 2023 Andrey Semashev
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
]
[section:is_swappable is_swappable]
template <class T>
struct is_swappable : public __tof {};
__inherit 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.
__compat 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>`
[endsect]

View File

@ -108,6 +108,7 @@
[def __is_nothrow_move_constructible [link boost_typetraits.reference.is_nothrow_move_constructible is_nothrow_move_constructible]]
[def __has_nothrow_assign [link boost_typetraits.reference.has_nothrow_assign has_nothrow_assign]]
[def __is_nothrow_move_assignable [link boost_typetraits.reference.is_nothrow_move_assignable is_nothrow_move_assignable]]
[def __is_swappable [link boost_typetraits.reference.is_swappable is_swappable]]
[def __is_nothrow_swappable [link boost_typetraits.reference.is_nothrow_swappable is_nothrow_swappable]]
[def __is_base_of [link boost_typetraits.reference.is_base_of is_base_of]]
@ -440,6 +441,7 @@ See __has_trivial_constructor.
[include is_scoped_enum.qbk]
[include is_signed.qbk]
[include is_stateless.qbk]
[include is_swappable.qbk]
[include is_trivially_copyable.qbk]
[include is_unbounded_array.qbk]
[include is_union.qbk]

View File

@ -131,6 +131,7 @@
#include <boost/type_traits/is_scoped_enum.hpp>
#include <boost/type_traits/is_signed.hpp>
#include <boost/type_traits/is_stateless.hpp>
#include <boost/type_traits/is_swappable.hpp>
#include <boost/type_traits/is_trivially_copyable.hpp>
#include <boost/type_traits/is_union.hpp>
#include <boost/type_traits/is_unscoped_enum.hpp>

View File

@ -2,12 +2,14 @@
#define BOOST_TYPE_TRAITS_DETAIL_IS_SWAPPABLE_CXX_11_HPP_INCLUDED
// Copyright 2017 Peter Dimov
// Copyright 2023 Andrey Semashev
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#include <boost/type_traits/declval.hpp>
#include <boost/type_traits/integral_constant.hpp>
#if __cplusplus >= 201103L || defined(BOOST_DINKUMWARE_STDLIB)
@ -22,6 +24,18 @@ namespace boost_type_traits_swappable_detail
using std::swap;
template<class T, class U, class = decltype(swap(boost::declval<T>(), boost::declval<U>()))> boost::true_type is_swappable_with_impl( int );
template<class T, class U> boost::false_type is_swappable_with_impl( ... );
template<class T, class U>
struct is_swappable_with_helper { typedef decltype( boost_type_traits_swappable_detail::is_swappable_with_impl<T, U>(0) ) type; };
template<class T, class = decltype(swap(boost::declval<T&>(), boost::declval<T&>()))> boost::true_type is_swappable_impl( int );
template<class T> boost::false_type is_swappable_impl( ... );
template<class T>
struct is_swappable_helper { typedef decltype( boost_type_traits_swappable_detail::is_swappable_impl<T>(0) ) type; };
#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !BOOST_WORKAROUND(BOOST_GCC, < 40700)
template<class T, class U, bool B = noexcept(swap(boost::declval<T>(), boost::declval<U>()))> boost::integral_constant<bool, B> is_nothrow_swappable_with_impl( int );
template<class T, class U> boost::false_type is_nothrow_swappable_with_impl( ... );
template<class T, class U>
@ -32,6 +46,8 @@ template<class T> boost::false_type is_nothrow_swappable_impl( ... );
template<class T>
struct is_nothrow_swappable_helper { typedef decltype( boost_type_traits_swappable_detail::is_nothrow_swappable_impl<T>(0) ) type; };
#endif // !defined(BOOST_NO_CXX11_NOEXCEPT) && !BOOST_WORKAROUND(BOOST_GCC, < 40700)
} // namespace boost_type_traits_swappable_detail
#endif // #ifndef BOOST_TYPE_TRAITS_DETAIL_IS_SWAPPABLE_CXX_11_HPP_INCLUDED

View File

@ -0,0 +1,92 @@
#ifndef BOOST_TYPE_TRAITS_IS_SWAPPABLE_HPP_INCLUDED
#define BOOST_TYPE_TRAITS_IS_SWAPPABLE_HPP_INCLUDED
// Copyright 2023 Andrey Semashev
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && \
!(defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_CXX_VERSION < 201703L))
#include <boost/type_traits/detail/is_swappable_cxx_11.hpp>
namespace boost
{
template<class T, class U> struct is_swappable_with : boost_type_traits_swappable_detail::is_swappable_with_helper<T, U>::type
{
};
template<class T> struct is_swappable : boost_type_traits_swappable_detail::is_swappable_helper<T>::type
{
};
} // namespace boost
#elif defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_CXX_VERSION < 201703L) && \
!defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) // these are required for is_constructible and is_assignable
// MSVC standard library has SFINAE-unfriendly std::swap in C++ modes prior to C++17,
// so we have to reproduce the restrictions on std::swap that are in effect in C++17 mode.
#include <cstddef>
#include <boost/type_traits/negation.hpp>
#include <boost/type_traits/conjunction.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/is_constructible.hpp>
#include <boost/type_traits/is_assignable.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/detail/is_swappable_cxx_11.hpp>
namespace boost
{
template<class T> struct is_swappable
: boost::conjunction<
boost::negation< boost::is_const<T> >,
boost::is_constructible<T, T&&>,
boost::is_assignable<T&, T&&>
>::type {};
template<> struct is_swappable<void> : false_type {};
template<> struct is_swappable<const void> : false_type {};
template<> struct is_swappable<volatile void> : false_type {};
template<> struct is_swappable<const volatile void> : false_type {};
template<class T> struct is_swappable<T[]> : false_type {};
template<class T> struct is_swappable<T(&)[]> : false_type {};
template<class T, std::size_t N> struct is_swappable<T[N]> : is_swappable<T> {};
template<class T, std::size_t N> struct is_swappable<T(&)[N]> : is_swappable<T> {};
template<class T, class U> struct is_swappable_with : boost_type_traits_swappable_detail::is_swappable_with_helper<T, U>::type
{
};
template<class T> struct is_swappable_with<T, T> : is_swappable<T> {};
} // namespace boost
#else
#include <boost/type_traits/is_scalar.hpp>
#include <boost/type_traits/integral_constant.hpp>
namespace boost
{
template<class T> struct is_swappable : boost::is_scalar<T> {};
template<class T> struct is_swappable<const T> : false_type {};
template<class T, class U> struct is_swappable_with : false_type {};
template<class T> struct is_swappable_with<T, T> : is_swappable<T> {};
} // namespace boost
#endif
#endif // #ifndef BOOST_TYPE_TRAITS_IS_SWAPPABLE_HPP_INCLUDED

View File

@ -1,21 +1,21 @@
# copyright John Maddock 2004
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# bring in the rules for testing
import testing ;
import os ;
if [ os.environ CI ]
if [ os.environ CI ]
{
CI_DEFINES = <define>CI_SUPPRESS_KNOWN_ISSUES=1 ;
CI_DEFINES = <define>CI_SUPPRESS_KNOWN_ISSUES=1 ;
}
# type_traits in V1 seem to have two modes: standalone, triggered
# by a command line option, and a regular. For now, just imitate
# regular
# regular
project : requirements
# default to all warnings on:
@ -32,7 +32,7 @@ project : requirements
<toolset>msvc:<warnings-as-errors>on
<include>libs/tt2/light/include
$(CI_DEFINES)
;
;
rule all-tests {
local result ;
@ -51,9 +51,9 @@ rule all-tests {
{
result += [ run $(source).cpp : : : <define>BOOST_TT_DISABLE_INTRINSICS : $(source)_no_intrinsics ] ;
}
return $(result) ;
return $(result) ;
}
test-suite type_traits : [ all-tests ] ;

231
test/is_swappable_test.cpp Normal file
View File

@ -0,0 +1,231 @@
// Copyright 2023 Andrey Semashev
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#ifdef TEST_STD
# include <type_traits>
#else
# include <boost/type_traits/is_swappable.hpp>
#endif
#include <boost/config.hpp>
#include "test.hpp"
#include "check_integral_constant.hpp"
#include <utility>
// These conditions should be similar to those in is_swappable.hpp
#if defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_CXX_VERSION < 201703L) && \
!defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) // these are required for is_constructible and is_assignable
#define BOOST_TYPE_TRAITS_IS_SWAPPABLE_MSVC_EMULATED
#elif defined(BOOST_NO_SFINAE_EXPR) || defined(BOOST_NO_CXX11_DECLTYPE) || defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS)
#define BOOST_TYPE_TRAITS_IS_SWAPPABLE_CXX03_EMULATED
#endif
struct X
{
};
struct Y
{
Y( Y const& ) {}
};
struct Z
{
Z& operator=( Z const& ) { return *this; }
};
struct U
{
};
void swap(U&, U&) {}
#if !defined(BOOST_TYPE_TRAITS_IS_SWAPPABLE_CXX03_EMULATED) && !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
struct not_swappable
{
not_swappable(not_swappable const&) = delete;
not_swappable& operator= (not_swappable const&) = delete;
};
namespace test_ns {
// Not swappable using std::swap, but swappable using test_ns::swap
struct only_adl_swappable
{
only_adl_swappable(only_adl_swappable const&) = delete;
only_adl_swappable& operator= (only_adl_swappable const&) = delete;
};
inline void swap(only_adl_swappable&, only_adl_swappable&) BOOST_NOEXCEPT {}
} // namespace test_ns
#endif
TT_TEST_BEGIN(is_swappable)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<int const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<int volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<int const volatile>::value, false);
#if defined(BOOST_TYPE_TRAITS_IS_SWAPPABLE_CXX03_EMULATED)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<int[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<int const[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<int volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<int const volatile[2]>::value, false);
#else
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<int[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<int const[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<int volatile[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<int const volatile[2]>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<void>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<void const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<void volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<void const volatile>::value, false);
#if defined(BOOST_TYPE_TRAITS_IS_SWAPPABLE_CXX03_EMULATED)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X const[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X const volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y const[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y const volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z const[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z const volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<U>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<U const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<U volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<U const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<X, int> >::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<X, int> const>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<X, int> volatile>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<X, int> const volatile>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<Y, int> >::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<Y, int> const>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<Y, int> volatile>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<Y, int> const volatile>::value), false);
#else // defined(BOOST_TYPE_TRAITS_IS_SWAPPABLE_CXX03_EMULATED)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X const[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<X const volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y const[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Y const volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z const[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<Z const volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<U>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<U const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<U volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<U const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<X, int> >::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<X, int> const>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<X, int> volatile>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<X, int> const volatile>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<Y, int> >::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<Y, int> const>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<Y, int> volatile>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_swappable<std::pair<Y, int> const volatile>::value), false);
#endif // defined(BOOST_TYPE_TRAITS_IS_SWAPPABLE_CXX03_EMULATED)
#if !defined(BOOST_TYPE_TRAITS_IS_SWAPPABLE_CXX03_EMULATED) && !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<not_swappable>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<not_swappable const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<not_swappable volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<not_swappable const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<not_swappable[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<not_swappable const[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<not_swappable volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<not_swappable const volatile[2]>::value, false);
#if !defined(BOOST_TYPE_TRAITS_IS_SWAPPABLE_MSVC_EMULATED)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable const[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable const volatile[2]>::value, false);
#else // !defined(BOOST_TYPE_TRAITS_IS_SWAPPABLE_MSVC_EMULATED)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable const>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable const[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable volatile[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_swappable<test_ns::only_adl_swappable const volatile[2]>::value, false);
#endif // !defined(BOOST_TYPE_TRAITS_IS_SWAPPABLE_MSVC_EMULATED)
#endif // !defined(BOOST_TYPE_TRAITS_IS_SWAPPABLE_CXX03_EMULATED) && !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
TT_TEST_END