]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/example/any_of.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / any_of.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/any_of.hpp>
6#include <boost/hana/assert.hpp>
7#include <boost/hana/config.hpp>
8#include <boost/hana/ext/std/integral_constant.hpp>
9#include <boost/hana/integral_constant.hpp>
10#include <boost/hana/mod.hpp>
11#include <boost/hana/not.hpp>
12#include <boost/hana/not_equal.hpp>
13#include <boost/hana/traits.hpp>
14#include <boost/hana/tuple.hpp>
15#include <boost/hana/type.hpp>
16
17#include <type_traits>
18namespace hana = boost::hana;
19using namespace hana::literals;
20
21
22BOOST_HANA_CONSTEXPR_LAMBDA auto is_odd = [](auto x) {
23 return x % 2_c != 0_c;
24};
25
26int main() {
27 BOOST_HANA_CONSTEXPR_CHECK(hana::any_of(hana::make_tuple(1, 2), is_odd));
28 BOOST_HANA_CONSTANT_CHECK(!hana::any_of(hana::make_tuple(2_c, 4_c), is_odd));
29
30 BOOST_HANA_CONSTANT_CHECK(
31 hana::any_of(hana::make_tuple(hana::type<void>{}, hana::type<char&>{}),
32 hana::traits::is_void)
33 );
34
35 BOOST_HANA_CONSTANT_CHECK(
36 !hana::any_of(hana::make_tuple(hana::type<void>{}, hana::type<char&>{}),
37 hana::traits::is_integral)
38 );
39}