]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/filter.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / filter.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/std/integral_constant.hpp>
8 #include <boost/hana/filter.hpp>
9 #include <boost/hana/functional/compose.hpp>
10 #include <boost/hana/optional.hpp>
11 #include <boost/hana/tuple.hpp>
12 #include <boost/hana/type.hpp>
13
14 #include <type_traits>
15 namespace hana = boost::hana;
16
17
18 // First take the type of an object, and then tell whether it's integral
19 constexpr auto is_integral = hana::compose(hana::trait<std::is_integral>, hana::typeid_);
20
21 static_assert(hana::filter(hana::make_tuple(1, 2.0, 3, 4.0), is_integral) == hana::make_tuple(1, 3), "");
22 static_assert(hana::filter(hana::just(3), is_integral) == hana::just(3), "");
23 BOOST_HANA_CONSTANT_CHECK(hana::filter(hana::just(3.0), is_integral) == hana::nothing);
24
25 int main() { }