123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- [#string]
- [section string]
- [h1 Synopsis]
- template <char C1, ..., char Cn>
- struct string;
- This is a [link metaprogramming_value template metaprogramming value].
- [table Arguments
- [[Name] [Type]]
- [[`C1`..`Cn`] [character values]]
- ]
- [h1 Description]
- Compile-time data-structure describing a string object. These string objects are
- compatible with `boost::mpl::string`, but they accept only individual characters
- as arguments. When `constexpr` is available, they can be constructed using the
- [link BOOST_METAPARSE_STRING `BOOST_METAPARSE_STRING`] macro.
- The tag of the strings is [link string_tag `string_tag`].
- [*C++98]: The maximum length of these strings is controlled by the
- `BOOST_METAPARSE_LIMIT_STRING_SIZE` macro.
- [*C++11]: The strings use variadic templates.
- [h1 Header]
- #include <boost/metaparse/string.hpp>
- [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]
|