]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/example/tuple/tuple.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / tuple / tuple.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/integral_constant.hpp>
8#include <boost/hana/transform.hpp>
9#include <boost/hana/tuple.hpp>
10
11#include <string>
12namespace hana = boost::hana;
13using namespace hana::literals;
14
15
16struct Fish { std::string name; };
17struct Cat { std::string name; };
18struct Dog { std::string name; };
19
20int main() {
21 hana::tuple<Fish, Cat, Dog> animals{{"Nemo"}, {"Garfield"}, {"Snoopy"}};
22 animals[0_c].name = "Moby Dick"; // can modify elements in place, like std::tuple
23
24 auto names = hana::transform(animals, [](auto a) {
25 return a.name;
26 });
27
28 BOOST_HANA_RUNTIME_CHECK(names == hana::make_tuple("Moby Dick", "Garfield", "Snoopy"));
29}