| 1 | // Copyright Louis Dionne 2013-2022 |
|---|---|
| 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/for_each.hpp> |
| 6 | #include <boost/hana/tuple.hpp> |
| 7 | #include <boost/hana/ext/boost/fusion/vector.hpp> |
| 8 | |
| 9 | #include <boost/fusion/include/vector.hpp> |
| 10 | |
| 11 | #include <iostream> |
| 12 | namespace fusion = boost::fusion; |
| 13 | namespace hana = boost::hana; |
| 14 | |
| 15 | |
| 16 | //! [main] |
| 17 | // In the old code, this used to receive a Fusion sequence. |
| 18 | // Now, it can be either a Hana sequence or a Fusion sequence. |
| 19 | template <typename Sequence> |
| 20 | void f(Sequence const& seq) { |
| 21 | hana::for_each(seq, [](auto const& element) { |
| 22 | std::cout << element << std::endl; |
| 23 | }); |
| 24 | } |
| 25 | //! [main] |
| 26 | |
| 27 | |
| 28 | int main() { |
| 29 | f(seq: hana::make_tuple(1, 2, 3)); |
| 30 | f(seq: fusion::make_vector(arg: 1, arg: 2, arg: 3)); |
| 31 | } |
| 32 |
