• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[#string]
2[section string]
3
4[h1 Synopsis]
5
6  template <char C1, ..., char Cn>
7  struct string;
8
9This is a [link metaprogramming_value template metaprogramming value].
10
11[table Arguments
12  [[Name]       [Type]]
13  [[`C1`..`Cn`] [character values]]
14]
15
16[h1 Description]
17
18Compile-time data-structure describing a string object. These string objects are
19compatible with `boost::mpl::string`, but they accept only individual characters
20as arguments. When `constexpr` is available, they can be constructed using the
21[link BOOST_METAPARSE_STRING `BOOST_METAPARSE_STRING`] macro.
22
23The tag of the strings is [link string_tag `string_tag`].
24
25[*C++98]: The maximum length of these strings is controlled by the
26`BOOST_METAPARSE_LIMIT_STRING_SIZE` macro.
27
28[*C++11]: The strings use variadic templates.
29
30[h1 Header]
31
32  #include <boost/metaparse/string.hpp>
33
34[h1 Example]
35
36  #include <boost/metaparse/string.hpp>
37
38  #include <type_traits>
39
40  using namespace boost::metaparse;
41
42  using hello1 = string<'H','e','l','l','o'>;
43  using hello2 = BOOST_METAPARSE_STRING("Hello");
44
45  static_assert(
46    std::is_same<
47      string<'H', 'e', 'l', 'l', 'o'>,
48      BOOST_METAPARSE_STRING("Hello")
49    >::type::value,
50    "The type generated by the macro should be identical to the hand-crafted one."
51  );
52
53[endsect]
54
55