]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/integral_constant/std_api.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / test / integral_constant / std_api.cpp
1 // Copyright Louis Dionne 2013-2017
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4
5 #include <boost/hana/integral_constant.hpp>
6
7 #include <cstddef>
8 #include <type_traits>
9 namespace hana = boost::hana;
10
11
12 // operator()
13 static_assert(hana::size_c<0>() == 0, "");
14 static_assert(hana::size_c<1>() == 1, "");
15 static_assert(hana::int_c<-3>() == -3, "");
16
17 // decltype(operator())
18 static_assert(std::is_same<decltype(hana::size_c<0>()), std::size_t>{}, "");
19 static_assert(std::is_same<decltype(hana::int_c<-3>()), int>{}, "");
20
21 // conversions
22 constexpr std::size_t a = hana::size_c<0>, b = hana::size_c<1>;
23 static_assert(a == 0 && b == 1, "");
24
25 constexpr int c = hana::int_c<0>, d = hana::int_c<-3>;
26 static_assert(c == 0 && d == -3, "");
27
28 // nested ::value
29 static_assert(decltype(hana::int_c<1>)::value == 1, "");
30
31 // nested ::type
32 static_assert(std::is_same<
33 decltype(hana::int_c<1>)::type,
34 std::remove_cv_t<decltype(hana::int_c<1>)>
35 >{}, "");
36
37 // nested ::value_type
38 static_assert(std::is_same<decltype(hana::int_c<1>)::value_type, int>{}, "");
39
40 // inherits from std::integral_constant
41 static_assert(std::is_base_of<std::integral_constant<int, 3>,
42 hana::integral_constant<int, 3>>{}, "");
43
44 int main() { }