]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/example/ext/boost/fusion/vector.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / ext / boost / fusion / vector.cpp
CommitLineData
b32b8144 1// Copyright Louis Dionne 2013-2017
7c673cae
FG
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/assert.hpp>
6#include <boost/hana/equal.hpp>
7#include <boost/hana/ext/boost/fusion/vector.hpp>
8#include <boost/hana/integral_constant.hpp>
9#include <boost/hana/transform.hpp>
10
11#include <boost/fusion/include/make_vector.hpp>
12#include <boost/fusion/include/vector.hpp>
13
14#include <string>
15namespace fusion = boost::fusion;
16namespace hana = boost::hana;
17
18
19struct Fish { std::string name; };
20struct Cat { std::string name; };
21struct Dog { std::string name; };
22
23int main() {
24 fusion::vector<Fish, Cat, Dog> animals{Fish{"Nemo"}, Cat{"Garfield"}, Dog{"Snoopy"}};
25 hana::front(animals).name = "Moby Dick";
26
27 auto names = hana::transform(animals, [](auto a) {
28 return a.name;
29 });
30
31 BOOST_HANA_RUNTIME_CHECK(hana::equal(
32 names,
33 fusion::make_vector("Moby Dick", "Garfield", "Snoopy")
34 ));
35}