is_empty.cpp 1.4 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/assert.hpp>
  5. #include <boost/hana/experimental/view.hpp>
  6. #include <boost/hana/is_empty.hpp>
  7. #include <boost/hana/not.hpp>
  8. #include <support/seq.hpp>
  9. namespace hana = boost::hana;
  10. template <int> struct undefined { };
  11. int main() {
  12. auto container = ::seq;
  13. {
  14. auto storage1 = container();
  15. auto storage2 = container();
  16. auto joined = hana::experimental::joined(storage1, storage2);
  17. BOOST_HANA_CONSTANT_CHECK(hana::is_empty(joined));
  18. }
  19. {
  20. auto storage1 = container(undefined<0>{});
  21. auto storage2 = container();
  22. auto joined = hana::experimental::joined(storage1, storage2);
  23. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(joined)));
  24. }
  25. {
  26. auto storage1 = container(undefined<0>{});
  27. auto storage2 = container(undefined<1>{});
  28. auto joined = hana::experimental::joined(storage1, storage2);
  29. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(joined)));
  30. }
  31. {
  32. auto storage1 = container();
  33. auto storage2 = container(undefined<0>{});
  34. auto joined = hana::experimental::joined(storage1, storage2);
  35. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(joined)));
  36. }
  37. }