]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/type_traits/test/enable_if_test.cpp
2 Copyright 2018 Glen Joseph Fernandes
5 Distributed under the Boost Software License,
6 Version 1.0. (See accompanying file LICENSE_1_0.txt
7 or copy at http://www.boost.org/LICENSE_1_0.txt)
9 #include <boost/type_traits/enable_if.hpp>
21 : Constant
<false> { };
30 Construct(T
, typename
boost::enable_if_
<Check
<T
>::value
>::type
* = 0)
33 Construct(T
, typename
boost::enable_if_
<!Check
<T
>::value
>::type
* = 0)
42 template<class T
, class E
= void>
46 struct Specialize
<T
, typename
boost::enable_if_
<Check
<T
>::value
>::type
>
50 struct Specialize
<T
, typename
boost::enable_if_
<!Check
<T
>::value
>::type
>
51 : Constant
<false> { };
54 typename
boost::enable_if_
<Check
<T
>::value
, bool>::type
Returns(T
)
60 typename
boost::enable_if_
<!Check
<T
>::value
, bool>::type
Returns(T
)
65 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
67 boost::enable_if_t
<Check
<T
>::value
, bool> Alias(T
)
73 boost::enable_if_t
<!Check
<T
>::value
, bool> Alias(T
)
79 TT_TEST_BEGIN(enable_if
)
81 BOOST_CHECK(!Construct(1).value());
82 BOOST_CHECK(Construct(1L).value());
83 BOOST_CHECK(!Specialize
<int>::value
);
84 BOOST_CHECK(Specialize
<long>::value
);
85 BOOST_CHECK(!Returns(1));
86 BOOST_CHECK(Returns(1L));
87 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
88 BOOST_CHECK(!Alias(1));
89 BOOST_CHECK(Alias(1L));