]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/fold_right/ref.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/at.hpp>
7 #include <boost/hana/fold_right.hpp>
8 #include <boost/hana/tuple.hpp>
9 namespace hana
= boost::hana
;
12 // Make sure that we can fold_right and take arguments by reference.
18 auto xs
= hana::make_tuple(1, 2, 3);
21 int& one
= hana::fold_right(xs
, state
, [](int& i
, int&) -> int& {
24 BOOST_HANA_RUNTIME_CHECK(one
== 1);
26 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<0>(xs
) == 10);
31 auto xs
= hana::make_tuple(1, 2, 3);
32 int& one
= hana::fold_right(xs
, [](int& i
, int&) -> int& {
35 BOOST_HANA_RUNTIME_CHECK(one
== 1);
37 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<0>(xs
) == 10);