transform.cpp 738 B

1234567891011121314151617181920212223242526272829
  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/equal.hpp>
  6. #include <boost/hana/optional.hpp>
  7. #include <boost/hana/transform.hpp>
  8. #include <laws/base.hpp>
  9. namespace hana = boost::hana;
  10. using hana::test::ct_eq;
  11. struct undefined { };
  12. int main() {
  13. hana::test::_injection<0> f{};
  14. BOOST_HANA_CONSTANT_CHECK(hana::equal(
  15. hana::transform(hana::nothing, undefined{}),
  16. hana::nothing
  17. ));
  18. BOOST_HANA_CONSTANT_CHECK(hana::equal(
  19. hana::transform(hana::just(ct_eq<3>{}), f),
  20. hana::just(f(ct_eq<3>{}))
  21. ));
  22. }