drop_while.cpp 929 B

123456789101112131415161718192021222324252627282930313233
  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/drop_while.hpp>
  6. #include <boost/hana/equal.hpp>
  7. #include <boost/hana/integral_constant.hpp>
  8. #include <boost/hana/less.hpp>
  9. #include <boost/hana/negate.hpp>
  10. #include <boost/hana/range.hpp>
  11. #include <boost/hana/tuple.hpp>
  12. namespace hana = boost::hana;
  13. using namespace hana::literals;
  14. auto negative = [](auto x) {
  15. return x < hana::int_c<0>;
  16. };
  17. BOOST_HANA_CONSTANT_CHECK(
  18. hana::drop_while(hana::make_range(hana::int_c<-3>, hana::int_c<6>), negative)
  19. ==
  20. hana::make_range(hana::int_c<0>, hana::int_c<6>)
  21. );
  22. BOOST_HANA_CONSTANT_CHECK(
  23. hana::drop_while(hana::make_tuple(1_c, -2_c, 4_c, 5_c), negative)
  24. ==
  25. hana::make_tuple(1_c, -2_c, 4_c, 5_c)
  26. );
  27. int main() { }