/* @copyright Louis Dionne 2014 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #include #include #include #include #include // instances #include #include using namespace boost::hana; struct T { }; struct U; namespace boost { namespace hana { namespace test { template <> auto instances = tuple(type); template <> auto objects = tuple( type, type, type, type, type, type, type, type, type ); }}} int main() { test::check_datatype(); // Type interface and helper functions { // decltype_ { BOOST_HANA_CONSTANT_CHECK(equal(decltype_(1), type)); BOOST_HANA_CONSTANT_CHECK(equal(decltype_('1'), type)); BOOST_HANA_CONSTANT_CHECK(equal(decltype_(T{}), type)); } // sizeof_ { BOOST_HANA_CONSTANT_CHECK(equal(sizeof_(type), size_t)); BOOST_HANA_CONSTANT_CHECK(equal(sizeof_(type), size_t)); } // nested ::type { static_assert(std::is_same)::type, T>{}, ""); } // unary + { auto& ref = type; auto const& cref = type; auto&& rref = type; auto val = type; BOOST_HANA_CONSTANT_CHECK(equal(val, +val)); BOOST_HANA_CONSTANT_CHECK(equal(val, +ref)); BOOST_HANA_CONSTANT_CHECK(equal(val, +cref)); BOOST_HANA_CONSTANT_CHECK(equal(val, +rref)); static_assert(!std::is_reference{}, ""); static_assert(!std::is_reference{}, ""); static_assert(!std::is_reference{}, ""); static_assert(!std::is_reference{}, ""); using T1 = decltype(+val)::type; using T2 = decltype(+ref)::type; using T3 = decltype(+cref)::type; using T4 = decltype(+rref)::type; } } // Comparable { // equal { BOOST_HANA_CONSTANT_CHECK(equal(type, type)); BOOST_HANA_CONSTANT_CHECK(not_(equal(type, type))); BOOST_HANA_CONSTANT_CHECK(not_(equal(type, type))); BOOST_HANA_CONSTANT_CHECK(not_(equal(type, type))); BOOST_HANA_CONSTANT_CHECK(equal(type, type)); BOOST_HANA_CONSTANT_CHECK(equal(type, type)); BOOST_HANA_CONSTANT_CHECK(not_(equal(type, type))); BOOST_HANA_CONSTANT_CHECK(not_(equal(type, type))); BOOST_HANA_CONSTANT_CHECK(equal(type, type)); } } }