...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Front Page / Sequences / Classes / string |
string is a variadic, bidirectional, extensible Integral Sequence Wrapper of characters that supports amortized constant-time insertion and removal of elements at both ends, and linear-time insertion and removal of elements in the middle. The parameters to string are multi-character literals, giving a somewhat readable syntax for compile-time strings. string can also be an argument to the c_str metafunction, which generates a null-terminated character array that facilitates interoperability with runtime string processing routines.
Sequence form | Header |
---|---|
Variadic | #include <boost/mpl/string.hpp> |
In the following table, s is an instance of string, pos and last are iterators into s, r is a Forward Sequence of characters, n and x are Integral Constants, and c1,c2,... cn are arbitrary (multi-)characters.
Expression | Semantics |
---|---|
string<c1,c2,... cn> |
string of characters c1,c2,... cn; see Variadic Sequence. |
string<c1,c2,... cn>::type |
Identical to string<c1,c2,... cn>; see Variadic Sequence. |
begin |
An iterator pointing to the beginning of s; see Bidirectional Sequence. |
end |
An iterator pointing to the end of s; see Bidirectional Sequence. |
size |
The size of s; see Bidirectional Sequence. |
empty |
A boolean Integral Constant c such that c::value == true if and only if the sequence is empty; see Bidirectional Sequence. |
front |
The first element in s; see Bidirectional Sequence. |
back |
The last element in s; see Bidirectional Sequence. |
insert |
A new string of following elements:
[begin |
insert_range |
A new string of following elements:
[begin |
erase |
A new string of following elements:
[begin |
erase |
A new string of following elements:
[begin |
clear |
An empty string; see Extensible Sequence. |
push_back |
A new string of following elements:
[begin |
pop_back |
A new string of following elements:
[begin |
push_front |
A new string of following elements:
[begin |
pop_front |
A new string of following elements:
[next< begin |
c_str |
A null-terminated byte string such that
c_str |