]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/string/c_str.cpp
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)
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/string.hpp>
9 namespace hana
= boost::hana
;
13 BOOST_HANA_RUNTIME_CHECK(std::strcmp(
14 BOOST_HANA_STRING("").c_str(),
18 BOOST_HANA_RUNTIME_CHECK(std::strcmp(
19 BOOST_HANA_STRING("a").c_str(),
23 BOOST_HANA_RUNTIME_CHECK(std::strcmp(
24 BOOST_HANA_STRING("ab").c_str(),
28 BOOST_HANA_RUNTIME_CHECK(std::strcmp(
29 BOOST_HANA_STRING("abc").c_str(),
33 BOOST_HANA_RUNTIME_CHECK(std::strcmp(
34 BOOST_HANA_STRING("abcd").c_str(),
38 // make sure we can turn a non-constexpr hana::string
39 // into a constexpr char const*
41 auto str
= BOOST_HANA_STRING("abcdef");
42 constexpr char const* c_str
= str
.c_str();
46 // make sure c_str is actually a static member function
48 constexpr char const* c_str
= hana::string
<'f', 'o', 'o'>::c_str();