any_of.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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/any_of.hpp>
  5. #include <boost/hana/assert.hpp>
  6. #include <boost/hana/equal.hpp>
  7. #include <boost/hana/not.hpp>
  8. #include <boost/hana/set.hpp>
  9. #include <laws/base.hpp>
  10. namespace hana = boost::hana;
  11. using hana::test::ct_eq;
  12. int main() {
  13. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
  14. hana::make_set(),
  15. hana::equal.to(ct_eq<1>{})
  16. )));
  17. BOOST_HANA_CONSTANT_CHECK(hana::any_of(
  18. hana::make_set(ct_eq<1>{}),
  19. hana::equal.to(ct_eq<1>{})
  20. ));
  21. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
  22. hana::make_set(ct_eq<1>{}),
  23. hana::equal.to(ct_eq<2>{})
  24. )));
  25. BOOST_HANA_CONSTANT_CHECK(hana::any_of(
  26. hana::make_set(ct_eq<1>{}, ct_eq<2>{}),
  27. hana::equal.to(ct_eq<1>{})
  28. ));
  29. BOOST_HANA_CONSTANT_CHECK(hana::any_of(
  30. hana::make_set(ct_eq<1>{}, ct_eq<2>{}),
  31. hana::equal.to(ct_eq<2>{})
  32. ));
  33. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
  34. hana::make_set(ct_eq<1>{}, ct_eq<2>{}),
  35. hana::equal.to(ct_eq<3>{})
  36. )));
  37. }