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_left.hpp>
8 #include <boost/hana/tuple.hpp>
9 namespace hana = boost::hana;
12 // Make sure that we can fold_left and take arguments by reference.
18 auto xs = hana::make_tuple(1, 2, 3);
21 int& three = hana::fold_left(xs, state, [](int&, int& i) -> int& {
24 BOOST_HANA_RUNTIME_CHECK(three == 3);
26 BOOST_HANA_RUNTIME_CHECK(hana::at_c<2>(xs) == 10);
31 auto xs = hana::make_tuple(1, 2, 3);
33 int& three = hana::fold_left(xs, [](int&, int& i) -> int& {
36 BOOST_HANA_RUNTIME_CHECK(three == 3);
38 BOOST_HANA_RUNTIME_CHECK(hana::at_c<2>(xs) == 10);