]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/none_of.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / hana / example / none_of.cpp
1 // Copyright Louis Dionne 2013-2016
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/config.hpp>
7 #include <boost/hana/ext/std/integral_constant.hpp>
8 #include <boost/hana/integral_constant.hpp>
9 #include <boost/hana/mod.hpp>
10 #include <boost/hana/none_of.hpp>
11 #include <boost/hana/not.hpp>
12 #include <boost/hana/not_equal.hpp>
13 #include <boost/hana/tuple.hpp>
14 #include <boost/hana/type.hpp>
15
16 #include <type_traits>
17 namespace hana = boost::hana;
18 using namespace hana::literals;
19
20
21 BOOST_HANA_CONSTEXPR_LAMBDA auto is_odd = [](auto x) {
22 return x % 2_c != 0_c;
23 };
24
25 int main() {
26 BOOST_HANA_CONSTANT_CHECK(hana::none_of(hana::make_tuple(2_c, 4_c), is_odd));
27 BOOST_HANA_CONSTEXPR_CHECK(!hana::none_of(hana::make_tuple(1, 2), is_odd));
28
29 BOOST_HANA_CONSTANT_CHECK(
30 !hana::none_of(hana::make_tuple(hana::type_c<void>, hana::type_c<char&>), hana::trait<std::is_void>)
31 );
32 BOOST_HANA_CONSTANT_CHECK(
33 hana::none_of(hana::make_tuple(hana::type_c<void>, hana::type_c<char&>), hana::trait<std::is_integral>)
34 );
35 }