optional.cpp 771 B

1234567891011121314151617181920212223242526272829
  1. // Copyright Jason Rice 2015
  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/printable.hpp>
  6. #include <boost/hana/integral_constant.hpp>
  7. #include <boost/hana/optional.hpp>
  8. #include <sstream>
  9. namespace hana = boost::hana;
  10. int main() {
  11. {
  12. std::ostringstream ss;
  13. ss << hana::experimental::print(
  14. hana::just(hana::int_c<5>)
  15. );
  16. BOOST_HANA_RUNTIME_CHECK(ss.str() == "just(5)");
  17. }
  18. {
  19. std::ostringstream ss;
  20. ss << hana::experimental::print(
  21. hana::nothing
  22. );
  23. BOOST_HANA_RUNTIME_CHECK(ss.str() == "nothing");
  24. }
  25. }