1
0
Fork 0
arangodb/3rdParty/boost/1.62.0/libs/metaparse/doc/BOOST_METAPARSE_STRING.qbk

64 lines
1.4 KiB
Plaintext

[#BOOST_METAPARSE_STRING]
[section BOOST_METAPARSE_STRING]
[h1 Synopsis]
#define BOOST_METAPARSE_STRING(s) \
// unspecified
This is a macro.
[table Arguments
[[Name] [Type]]
[[`s`] [string literal]]
]
[h1 Description]
Macro for defining [link string `string`] values. `s` is expected to be a
string literal. The macro requires C++11.
The maximal length of the string is limited. This limit is defined by the
`BOOST_METAPARSE_LIMIT_STRING_SIZE` macro.
On platforms where `BOOST_METAPARSE_STRING` is not supported, the `string.hpp`
header defines the `BOOST_METAPARSE_V1_CONFIG_NO_BOOST_METAPARSE_STRING` macro.
Defining this macro before including the header disables the
`BOOST_METAPARSE_STRING` macro.
[h1 Header]
#include <boost/metaparse/string.hpp>
[h1 Expression semantics]
The semantics of this macro is demonstrated by an example. The following
BOOST_METAPARSE_STRING("hello")
is equivalent to
string<'h','e','l','l','o'>
[h1 Example]
#include <boost/metaparse/string.hpp>
#include <type_traits>
using namespace boost::metaparse;
using hello1 = string<'H','e','l','l','o'>;
using hello2 = BOOST_METAPARSE_STRING("Hello");
static_assert(
std::is_same<
string<'H', 'e', 'l', 'l', 'o'>,
BOOST_METAPARSE_STRING("Hello")
>::type::value,
"The type generated by the macro should be identical to the hand-crafted one."
);
[endsect]