]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/type_traits/test/is_constructible_test.cpp
2 // (C) Copyright John Maddock 2000.
3 // Use, modification and distribution are subject to the
4 // Boost Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #include "check_integral_constant.hpp"
10 # include <type_traits>
12 # include <boost/type_traits/is_constructible.hpp>
16 struct non_copy_constructible
18 non_copy_constructible();
19 non_copy_constructible(int);
20 non_copy_constructible(double*, double*);
21 #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
22 non_copy_constructible(const non_copy_constructible
&) = delete;
24 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
25 non_copy_constructible(non_copy_constructible
&&);
33 TT_TEST_BEGIN(is_constructible
)
35 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
36 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<B
&&, A
>::value
) , false);
37 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<B
const &&, A
>::value
) , false);
38 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<B
const &&, A
const>::value
) , false);
39 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<B
volatile &&, A
>::value
) , false);
40 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<B
volatile &&, A
volatile>::value
) , false);
41 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<B
const volatile &&, A
>::value
) , false);
42 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<B
const volatile &&, A
const>::value
) , false);
43 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<B
const volatile &&, A
volatile>::value
) , false);
44 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<B
const volatile &&, A
const volatile>::value
) , false);
46 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<B
&, A
>::value
), false);
47 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<B
const &, A
>::value
), false);
48 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<B
const &, A
&>::value
), false);
49 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<B
const &, A
const>::value
), false);
51 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible
<non_copy_constructible
>::value
), true, false);
52 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible
<non_copy_constructible
, int>::value
), true, false);
53 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible
<non_copy_constructible
, int const>::value
), true, false);
54 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible
<non_copy_constructible
, int const&>::value
), true, false);
55 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible
<non_copy_constructible
, non_copy_constructible
>::value
), true, false);
56 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
57 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT((::tt::is_constructible
<non_copy_constructible
, double*, double*>::value
), true, false);
58 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<non_copy_constructible
, double const*, double*>::value
), false);
60 #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
61 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<non_copy_constructible
, const non_copy_constructible
&>::value
), false);
64 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<int, const int>::value
), true);
65 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<int, const int&>::value
), true);
66 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<int*, const int&>::value
), false);
67 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<int*, const int*>::value
), false);
68 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<int*, int*>::value
), true);
69 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<int*, int[2]>::value
), true);
70 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<int*, int[]>::value
), true);
72 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<int(*)(int), int&>::value
), false);
73 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<int(*)(int), int(*)(int)>::value
), true);
74 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<int(&)(int), int(int)>::value
), true);
75 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<int(int), int(int)>::value
), false);
76 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_constructible
<int(int), int(&)(int)>::value
), false);