[#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.

The upper limit for the maximum length, which can be used is 2048. The
implementation of the `BOOST_METAPARSE_STRING` macro is generated using
`tools/string_headers.py` and can be regenerated to extend this upper limit.
Note that for Oracle Developer Studio the string length limit is 127.

Metaparse supports changing the string length limit within a compilation unit.
To change the length limit, redefine the `BOOST_METAPARSE_LIMIT_STRING_SIZE`
macro.

You can find benchmarks of this macro
[link BOOST_METAPARSE_STRING_benchmark here].

[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]

  #define BOOST_METAPARSE_LIMIT_STRING_SIZE 8
  #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."
  );

  #undef BOOST_METAPARSE_LIMIT_STRING_SIZE
  #define BOOST_METAPARSE_LIMIT_STRING_SIZE 32

  static_assert(
    std::is_same<
      string<
        'A', ' ', 'l', 'o', 'n', 'g', 'e', 'r',
        ' ', 's', 't', 'r', 'i', 'n', 'g'
      >,
      BOOST_METAPARSE_STRING("A longer string")
    >::type::value,
    "The type generated by the macro should be identical to the hand-crafted one."
  );

[endsect]

