]>
Commit | Line | Data |
---|---|---|
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/optional.hpp> | |
6 | #include <boost/hana/type.hpp> | |
7 | ||
8 | #include <type_traits> | |
9 | namespace hana = boost::hana; | |
10 | ||
11 | ||
12 | // This test makes sure that an optional holding a hana::type has a | |
13 | // nested ::type alias. | |
14 | ||
15 | ||
16 | template <typename ...> | |
17 | using void_t = void; | |
18 | ||
19 | template <typename T, typename = void> | |
20 | struct has_type : std::false_type { }; | |
21 | ||
22 | template <typename T> | |
23 | struct has_type<T, void_t<typename T::type>> | |
24 | : std::true_type | |
25 | { }; | |
26 | ||
27 | ||
28 | struct T; | |
29 | ||
30 | static_assert(std::is_same<decltype(hana::just(hana::type_c<T>))::type, T>{}, ""); | |
31 | static_assert(!has_type<decltype(hana::nothing)>{}, ""); | |
32 | ||
33 | int main() { } |