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/not_equal.hpp>
10#include <boost/hana/string.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}, kevin{.name: "Kevin", .age: 20};
25
26 BOOST_HANA_RUNTIME_CHECK(hana::equal(john, john));
27 BOOST_HANA_RUNTIME_CHECK(hana::not_equal(john, kevin));
28}
29

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