]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/example/struct/to.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / struct / to.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/core/to.hpp>
7#include <boost/hana/define_struct.hpp>
8#include <boost/hana/equal.hpp>
9#include <boost/hana/map.hpp>
10#include <boost/hana/pair.hpp>
11#include <boost/hana/string.hpp>
12
13#include <string>
14namespace hana = boost::hana;
15
16
17struct Person {
18 BOOST_HANA_DEFINE_STRUCT(Person,
19 (std::string, name),
20 (unsigned short, age)
21 );
22};
23
24int main() {
25 Person john{"John", 30u};
26 BOOST_HANA_RUNTIME_CHECK(hana::to<hana::map_tag>(john) == hana::make_map(
27 hana::make_pair(BOOST_HANA_STRING("name"), "John"),
28 hana::make_pair(BOOST_HANA_STRING("age"), 30u)
29 ));
30}