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)
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/equal.hpp>
7 #include <boost/hana/ext/boost/mpl/list.hpp>
8 #include <boost/hana/ext/std/integral_constant.hpp>
9 #include <boost/hana/fold_left.hpp>
10 #include <boost/hana/if.hpp>
11 #include <boost/hana/integral_constant.hpp>
12 #include <boost/hana/plus.hpp>
13 #include <boost/hana/type.hpp>
15 #include <boost/mpl/list.hpp>
16 #include <type_traits>
17 namespace hana = boost::hana;
18 namespace mpl = boost::mpl;
21 auto types = mpl::list<long, float, short, float, long, long double>{};
22 auto number_of_floats = hana::fold_left(types, hana::int_c<0>, [](auto count, auto t) {
23 return hana::if_(hana::trait<std::is_floating_point>(t),
24 count + hana::int_c<1>,
29 BOOST_HANA_CONSTANT_CHECK(number_of_floats == hana::int_c<3>);