]> git.proxmox.com Git - ceph.git/blame - 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
CommitLineData
b32b8144 1// Copyright Louis Dionne 2013-2017
7c673cae
FG
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>
10namespace hana = boost::hana;
11
12
13constexpr hana::detail::create<std::tuple> make_tuple{};
14constexpr hana::detail::create<std::pair> make_pair{};
15
16template <typename ...>
17struct empty { };
18
19template <typename T>
20struct single_holder { T x; };
21
22template <typename T>
23struct identity { using type = T; };
24
25template <typename ...T>
26using identity_t = typename identity<T...>::type;
27
28int 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}