]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/example/permutations.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / permutations.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/all_of.hpp>
6#include <boost/hana/assert.hpp>
7#include <boost/hana/config.hpp>
8#include <boost/hana/contains.hpp>
9#include <boost/hana/functional/curry.hpp>
10#include <boost/hana/permutations.hpp>
11#include <boost/hana/tuple.hpp>
12namespace hana = boost::hana;
13
14
15BOOST_HANA_CONSTEXPR_LAMBDA auto is_permutation_of = hana::curry<2>([](auto xs, auto perm) {
16 return hana::contains(hana::permutations(xs), perm);
17});
18
19int main() {
20 BOOST_HANA_CONSTEXPR_CHECK(
21 hana::all_of(
22 hana::make_tuple(
23 hana::make_tuple('1', 2, 3.0),
24 hana::make_tuple('1', 3.0, 2),
25 hana::make_tuple(2, '1', 3.0),
26 hana::make_tuple(2, 3.0, '1'),
27 hana::make_tuple(3.0, '1', 2),
28 hana::make_tuple(3.0, 2, '1')
29 ),
30 is_permutation_of(hana::make_tuple('1', 2, 3.0))
31 )
32 );
33}