]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/detail/create.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / test / detail / create.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/config.hpp>
6 #include <boost/hana/detail/create.hpp>
7
8 #include <utility>
9 #include <tuple>
10 namespace hana = boost::hana;
11
12
13 constexpr hana::detail::create<std::tuple> make_tuple{};
14 constexpr hana::detail::create<std::pair> make_pair{};
15
16 template <typename ...>
17 struct empty { };
18
19 template <typename T>
20 struct single_holder { T x; };
21
22 template <typename T>
23 struct identity { using type = T; };
24
25 template <typename ...T>
26 using identity_t = typename identity<T...>::type;
27
28 int main() {
29 static_assert(make_tuple(1, '2', 3.3) == std::make_tuple(1, '2', 3.3), "");
30 static_assert(make_pair(1, '2') == std::make_pair(1, '2'), "");
31
32 // should work
33 hana::detail::create<empty>{}();
34 hana::detail::create<single_holder>{}(1);
35 hana::detail::create<single_holder>{}([]{});
36 hana::detail::create<identity_t>{}(1);
37
38 // Clang < 3.7.0 fails this test
39 #if !defined(BOOST_HANA_CONFIG_CLANG) || \
40 BOOST_HANA_CONFIG_CLANG >= BOOST_HANA_CONFIG_VERSION(3, 7, 0)
41 hana::detail::create<identity_t>{}([]{});
42 #endif
43 }