members.cpp 653 B

12345678910111213141516171819202122232425
  1. // Copyright Louis Dionne 2013-2017
  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. #include <boost/hana/assert.hpp>
  5. #include <boost/hana/define_struct.hpp>
  6. #include <boost/hana/equal.hpp>
  7. #include <boost/hana/members.hpp>
  8. #include <boost/hana/tuple.hpp>
  9. #include <string>
  10. namespace hana = boost::hana;
  11. struct Person {
  12. BOOST_HANA_DEFINE_STRUCT(Person,
  13. (std::string, name),
  14. (unsigned short, age)
  15. );
  16. };
  17. int main() {
  18. Person john{"John", 30};
  19. BOOST_HANA_RUNTIME_CHECK(hana::members(john) == hana::make_tuple("John", 30));
  20. }