// Copyright Louis Dionne 2013-2016 // 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 #include #include #include #include #include namespace hana = boost::hana; // First get the type of the object, and then call the trait on it. constexpr auto is_integral = hana::compose(hana::trait, hana::typeid_); constexpr auto is_class = hana::compose(hana::trait, hana::typeid_); static_assert( hana::find_if(hana::make_tuple(1.0, 2, '3'), is_integral) == hana::just(2) , ""); BOOST_HANA_CONSTANT_CHECK( hana::find_if(hana::make_tuple(1.0, 2, '3'), is_class) == hana::nothing ); constexpr auto types = hana::tuple_t; BOOST_HANA_CONSTANT_CHECK( hana::find_if(types, hana::equal.to(hana::type_c)) == hana::just(hana::type_c) ); BOOST_HANA_CONSTANT_CHECK( hana::find_if(types, hana::equal.to(hana::type_c)) == hana::nothing ); int main() { }