| 1 | // Copyright Louis Dionne 2013-2022 |
|---|---|
| 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(args: 1, args: '2', args: 3.3), ""); |
| 30 | static_assert(make_pair(1, '2') == std::make_pair(x: 1, y: '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 | hana::detail::create<identity_t>{}([]{}); |
| 38 | } |
| 39 |
