]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/string/to.cpp
1 // Copyright Louis Dionne 2013-2016
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)
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/core/to.hpp>
7 #include <boost/hana/string.hpp>
10 namespace hana
= boost::hana
;
13 static_assert(hana::is_convertible
<hana::string_tag
, char const*>{}, "");
14 static_assert(!hana::is_embedded
<hana::string_tag
, char const*>{}, "");
17 BOOST_HANA_RUNTIME_CHECK(std::strcmp(
18 hana::to
<char const*>(BOOST_HANA_STRING("")),
22 BOOST_HANA_RUNTIME_CHECK(std::strcmp(
23 hana::to
<char const*>(BOOST_HANA_STRING("a")),
27 BOOST_HANA_RUNTIME_CHECK(std::strcmp(
28 hana::to
<char const*>(BOOST_HANA_STRING("ab")),
32 BOOST_HANA_RUNTIME_CHECK(std::strcmp(
33 hana::to
<char const*>(BOOST_HANA_STRING("abc")),
37 BOOST_HANA_RUNTIME_CHECK(std::strcmp(
38 hana::to
<char const*>(BOOST_HANA_STRING("abcd")),
42 // make sure we can turn a non-constexpr hana::string
43 // into a constexpr char const*
44 auto str
= BOOST_HANA_STRING("abcdef");
45 constexpr char const* c_str
= hana::to
<char const*>(str
);