]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/ext/boost/mpl/list/foldable.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / ext / boost / mpl / list / foldable.cpp
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/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>
14
15 #include <boost/mpl/list.hpp>
16 #include <type_traits>
17 namespace hana = boost::hana;
18 namespace mpl = boost::mpl;
19
20
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>,
25 count
26 );
27 });
28
29 BOOST_HANA_CONSTANT_CHECK(number_of_floats == hana::int_c<3>);
30
31 int main() { }