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/assert.hpp> 6 #include <boost/hana/equal.hpp> 7 #include <boost/hana/type.hpp> 8 9 #include <type_traits> 10 namespace hana = boost::hana; 11 12 13 // This test checks that the unary + operator on types works as expected. 14 // The unary + operator is supposed to turn a reference to a hana::type 15 // object into an equivalent prvalue. 16 17 struct T; 18 main()19int main() { 20 auto& ref = hana::type_c<T>; 21 auto const& cref = hana::type_c<T>; 22 auto&& rref = hana::type_c<T>; 23 auto val = hana::type_c<T>; 24 25 BOOST_HANA_CONSTANT_CHECK(hana::equal(val, +val)); 26 BOOST_HANA_CONSTANT_CHECK(hana::equal(val, +ref)); 27 BOOST_HANA_CONSTANT_CHECK(hana::equal(val, +cref)); 28 BOOST_HANA_CONSTANT_CHECK(hana::equal(val, +rref)); 29 30 static_assert(!std::is_reference<decltype(+val)>{}, ""); 31 static_assert(!std::is_reference<decltype(+ref)>{}, ""); 32 static_assert(!std::is_reference<decltype(+cref)>{}, ""); 33 static_assert(!std::is_reference<decltype(+rref)>{}, ""); 34 35 using T1 = decltype(+val)::type; 36 using T2 = decltype(+ref)::type; 37 using T3 = decltype(+cref)::type; 38 using T4 = decltype(+rref)::type; 39 } 40