comparable.cpp 740 B

12345678910111213141516171819202122232425262728
  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/keys.hpp>
  8. #include <boost/hana/not_equal.hpp>
  9. #include <boost/hana/string.hpp>
  10. #include <string>
  11. namespace hana = boost::hana;
  12. struct Person {
  13. BOOST_HANA_DEFINE_STRUCT(Person,
  14. (std::string, name),
  15. (unsigned short, age)
  16. );
  17. };
  18. int main() {
  19. Person john{"John", 30}, kevin{"Kevin", 20};
  20. BOOST_HANA_RUNTIME_CHECK(hana::equal(john, john));
  21. BOOST_HANA_RUNTIME_CHECK(hana::not_equal(john, kevin));
  22. }