make.cpp 720 B

123456789101112131415161718192021222324
  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/bool.hpp>
  6. #include <boost/hana/config.hpp>
  7. #include <boost/hana/eval.hpp>
  8. #include <boost/hana/if.hpp>
  9. #include <boost/hana/lazy.hpp>
  10. namespace hana = boost::hana;
  11. int main() {
  12. BOOST_HANA_CONSTEXPR_LAMBDA auto f = hana::make<hana::lazy_tag>([](auto x) {
  13. return 1 / x;
  14. });
  15. BOOST_HANA_CONSTEXPR_LAMBDA auto g = hana::make_lazy([](auto x) {
  16. return x + 1;
  17. });
  18. BOOST_HANA_CONSTEXPR_CHECK(hana::eval(hana::if_(hana::false_c, f(0), g(0))) == 0 + 1);
  19. }