]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/ext/std/integer_sequence/foldable.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/ext/std/integer_sequence.hpp>
7 #include <boost/hana/unpack.hpp>
11 namespace hana
= boost::hana
;
14 auto add
= [](auto a
, auto b
, auto c
) { return a
+ b
+ c
; };
17 std::tuple
<int, long, double> tuple
{1, 2l, 3.3};
19 auto sum
= hana::unpack(std::integer_sequence
<int, 0, 1, 2>{}, [&](auto ...i
) {
20 // the `i`s are `std::integral_constant<int, ...>`s
21 return add(std::get
<decltype(i
)::value
>(tuple
)...);
24 BOOST_HANA_RUNTIME_CHECK(sum
== 6.3);