Blame view

3rdparty/boost_1_81_0/libs/metaparse/doc/string.qbk 1.27 KB
73ef4ff3   Hu Chunming   提交三方库
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  [#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]