]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/example/filter.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / filter.cpp
CommitLineData
b32b8144 1// Copyright Louis Dionne 2013-2017
7c673cae
FG
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>
15namespace hana = boost::hana;
16
17
18// First take the type of an object, and then tell whether it's integral
19constexpr auto is_integral = hana::compose(hana::trait<std::is_integral>, hana::typeid_);
20
21static_assert(hana::filter(hana::make_tuple(1, 2.0, 3, 4.0), is_integral) == hana::make_tuple(1, 3), "");
22static_assert(hana::filter(hana::just(3), is_integral) == hana::just(3), "");
23BOOST_HANA_CONSTANT_CHECK(hana::filter(hana::just(3.0), is_integral) == hana::nothing);
24
25int main() { }