]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/functional/demux.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)
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/equal.hpp>
7 #include <boost/hana/functional/demux.hpp>
9 #include <laws/base.hpp>
10 namespace hana
= boost::hana
;
11 using hana::test::ct_eq
;
16 MoveOnly(MoveOnly
const&) = delete;
17 MoveOnly(MoveOnly
&&) = default;
21 hana::test::_injection
<0> f
{};
22 hana::test::_injection
<1> g
{};
23 hana::test::_injection
<2> h
{};
25 BOOST_HANA_CONSTANT_CHECK(hana::equal(
30 BOOST_HANA_CONSTANT_CHECK(hana::equal(
31 hana::demux(f
)(g
)(ct_eq
<1>{}),
34 BOOST_HANA_CONSTANT_CHECK(hana::equal(
35 hana::demux(f
)(g
)(ct_eq
<1>{}, ct_eq
<2>{}),
36 f(g(ct_eq
<1>{}, ct_eq
<2>{}))
38 BOOST_HANA_CONSTANT_CHECK(hana::equal(
39 hana::demux(f
)(g
)(ct_eq
<1>{}, ct_eq
<2>{}, ct_eq
<3>{}),
40 f(g(ct_eq
<1>{}, ct_eq
<2>{}, ct_eq
<3>{}))
43 BOOST_HANA_CONSTANT_CHECK(hana::equal(
44 hana::demux(f
)(g
, h
)(ct_eq
<1>{}),
45 f(g(ct_eq
<1>{}), h(ct_eq
<1>{}))
47 BOOST_HANA_CONSTANT_CHECK(hana::equal(
48 hana::demux(f
)(g
, h
)(ct_eq
<1>{}, ct_eq
<2>{}),
49 f(g(ct_eq
<1>{}, ct_eq
<2>{}), h(ct_eq
<1>{}, ct_eq
<2>{}))
51 BOOST_HANA_CONSTANT_CHECK(hana::equal(
52 hana::demux(f
)(g
, h
)(ct_eq
<1>{}, ct_eq
<2>{}, ct_eq
<3>{}),
53 f(g(ct_eq
<1>{}, ct_eq
<2>{}, ct_eq
<3>{}), h(ct_eq
<1>{}, ct_eq
<2>{}, ct_eq
<3>{}))
56 // Make sure we can pass move-only types when a single function
57 // is demux'ed. In other words, make sure the arguments are
58 // perfect-forwarded when a single function is demux'ed.
60 hana::demux(f
)(g
)(MoveOnly
{});
61 hana::demux(f
)(g
)(MoveOnly
{}, MoveOnly
{});
62 hana::demux(f
)(g
)(MoveOnly
{}, MoveOnly
{}, MoveOnly
{});