literal.cpp 935 B

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/config.hpp>
  6. #include <boost/hana/core/is_a.hpp>
  7. #include <boost/hana/equal.hpp>
  8. #include <boost/hana/integral_constant.hpp>
  9. #include <boost/hana/length.hpp>
  10. #include <boost/hana/string.hpp>
  11. namespace hana = boost::hana;
  12. using namespace hana::literals;
  13. // By default, this is disabled
  14. #ifdef BOOST_HANA_CONFIG_ENABLE_STRING_UDL
  15. constexpr auto str = "Hello world!"_s;
  16. BOOST_HANA_CONSTANT_CHECK(str == hana::string_c<'H', 'e', 'l', 'l', 'o', ' ',
  17. 'w', 'o', 'r', 'l', 'd', '!'>);
  18. BOOST_HANA_CONSTANT_CHECK(hana::is_a<hana::string_tag>(str));
  19. BOOST_HANA_CONSTANT_CHECK(hana::length(str) == hana::size_c<12>);
  20. #endif
  21. int main() { }