]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/doc/src/refmanual/c_str.rst
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / c_str.rst
1 .. Metafunctions/String Operations//c_str |10
2
3
4 c_str
5 =====
6
7 Synopsis
8 --------
9
10 .. parsed-literal::
11
12 template<
13 typename Sequence
14 >
15 struct c_str
16 {
17 typedef |unspecified| type;
18 static char const value[];
19 };
20
21
22 Description
23 -----------
24
25 ``c_str`` converts the |Forward Sequence| of |Integral Constant|\ s ``Sequence``
26 into a null-terminated byte string containing an equivalent sequence.
27
28
29 Header
30 ------
31
32 .. parsed-literal::
33
34 #include <boost/mpl/string.hpp>
35
36
37 Model of
38 --------
39
40 |Metafunction|
41
42
43 Parameters
44 ----------
45
46 +---------------+---------------------------+-----------------------------------------------+
47 | Parameter | Requirement | Description |
48 +===============+===========================+===============================================+
49 | ``Sequence`` | |Forward Sequence| of | A sequence to be converted into a |
50 | | |Integral Constant|\ s | null-terminated byte string. |
51 +---------------+---------------------------+-----------------------------------------------+
52
53
54 Expression semantics
55 --------------------
56
57 .. compound::
58 :class: expression-semantics
59
60 For any |Forward Sequence| of |Integral Constant|\ s ``s``,
61
62 .. parsed-literal::
63
64 c_str<s>::value;
65
66 :Return type:
67 A null-terminated byte string.
68
69 :Precondition:
70 ``size<s>::value <= BOOST_MPL_STRING_MAX_LENGTH``.
71
72 :Semantics:
73 Equivalent to
74
75 .. parsed-literal::
76
77 char const value[] = {
78 at<s, 0>::type::value
79 , ...
80 , at<s, size<s>::value-1>::type::value
81 , '\\0'
82 };
83
84 Complexity
85 ----------
86
87 +-------------------------------+-----------------------------------+
88 | Sequence archetype | Complexity |
89 +===============================+===================================+
90 | |Forward Sequence| | Linear. |
91 +-------------------------------+-----------------------------------+
92
93 Example
94 -------
95
96 .. parsed-literal::
97
98 typedef vector_c<char,'h','e','l','l','o'> hello;
99 assert( 0 == std::strcmp( c_str<hello>::value, "hello" ) );
100
101 See also
102 --------
103
104 |Forward Sequence|, |Integral Constant|, |string|
105
106
107 .. copyright:: Copyright © 2009 Eric Niebler
108 Distributed under the Boost Software License, Version 1.0. (See accompanying
109 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)