]>
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/assert.hpp> | |
6 | #include <boost/hana/equal.hpp> | |
7 | #include <boost/hana/not.hpp> | |
8 | #include <boost/hana/not_equal.hpp> // for operator != | |
9 | #include <boost/hana/type.hpp> | |
10 | namespace hana = boost::hana; | |
11 | ||
12 | ||
13 | struct T; | |
14 | struct U; | |
15 | ||
16 | int main() { | |
17 | BOOST_HANA_CONSTANT_CHECK(hana::equal(hana::type_c<T>, hana::type_c<T>)); | |
18 | BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::type_c<T>, hana::type_c<U>))); | |
19 | BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::type_c<void>, hana::type_c<U>))); | |
20 | BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::type_c<T>, hana::type_c<void>))); | |
21 | BOOST_HANA_CONSTANT_CHECK(hana::equal(hana::type_c<void>, hana::type_c<void>)); | |
22 | ||
23 | BOOST_HANA_CONSTANT_CHECK(hana::equal(hana::type_c<T&>, hana::type_c<T&>)); | |
24 | BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::type_c<T&>, hana::type_c<T&&>))); | |
25 | BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::type_c<T const>, hana::type_c<T>))); | |
26 | BOOST_HANA_CONSTANT_CHECK(hana::equal(hana::type_c<T const>, hana::type_c<T const>)); | |
27 | ||
28 | // make sure we don't read from a non-constexpr variable in hana::equal | |
29 | auto t = hana::type_c<T>; | |
30 | static_assert(hana::equal(t, hana::type_c<T>), ""); | |
31 | ||
32 | // check operators | |
33 | BOOST_HANA_CONSTANT_CHECK(hana::type_c<T> == hana::type_c<T>); | |
34 | BOOST_HANA_CONSTANT_CHECK(hana::type_c<T> != hana::type_c<U>); | |
35 | } |