special.is_empty.cpp 1.0 KB

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/is_empty.hpp>
  6. #include <boost/hana/not.hpp>
  7. #include <boost/hana/tuple.hpp>
  8. namespace hana = boost::hana;
  9. struct x0;
  10. struct x1;
  11. struct x2;
  12. int main() {
  13. // tuple_t
  14. BOOST_HANA_CONSTANT_CHECK(hana::is_empty(hana::tuple_t<>));
  15. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(hana::tuple_t<x0>)));
  16. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(hana::tuple_t<x0, x1>)));
  17. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(hana::tuple_t<x0, x1, x2>)));
  18. // tuple_c
  19. BOOST_HANA_CONSTANT_CHECK(hana::is_empty(hana::tuple_c<int>));
  20. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(hana::tuple_c<int, 0>)));
  21. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(hana::tuple_c<int, 0, 1>)));
  22. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(hana::tuple_c<int, 0, 1, 2>)));
  23. }