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/assert.hpp>
6#include <boost/hana/define_struct.hpp>
7#include <boost/hana/equal.hpp>
8#include <boost/hana/keys.hpp>
9#include <boost/hana/string.hpp>
10#include <boost/hana/tuple.hpp>
11
12#include <string>
13namespace hana = boost::hana;
14
15
16struct Person {
17 BOOST_HANA_DEFINE_STRUCT(Person,
18 (std::string, name),
19 (unsigned short, age)
20 );
21};
22
23int main() {
24 Person john{.name: "John", .age: 30};
25 BOOST_HANA_CONSTANT_CHECK(
26 hana::keys(john) == hana::make_tuple(BOOST_HANA_STRING("name"),
27 BOOST_HANA_STRING("age"))
28 );
29}
30

source code of boost/libs/hana/example/struct/keys.cpp