![]() |
Home | Libraries | People | FAQ | More |
A fixed-capacity string.
Defined in header <boost/static_string/static_string.hpp>
template< std::size_t N, typename CharT, typename Traits = std::char_traits<CharT>> class basic_static_string
Name |
Description |
---|---|
The type of string_view_type returned by the interface. |
|
Name |
Description |
---|---|
Appends count copies of character ch Append to the string. |
|
Replace the contents. |
|
Access specified character with bounds checking. |
|
Accesses the last character. |
|
Construct a basic_static_string. |
|
Returns an iterator to the beginning. |
|
Returns a non-modifiable standard C character array version of the string. |
|
Returns the number of characters that can be held in currently allocated storage. |
|
Returns an iterator to the beginning. |
|
Returns an iterator to the end. |
|
Clears the contents. |
|
Compare the string with another. |
|
Copy a substring to another string. |
|
Returns a reverse iterator to the beginning. |
|
Returns a reverse iterator to the end. |
|
Returns a pointer to the first character of the string. Returns a pointer to the first character of a string. |
|
Returns true if the string is empty. |
|
Returns an iterator to the end. |
|
Returns whether the string ends with s Returns whether the string ends with c |
|
Removes min(count, size() - index) characters starting at index Removes the character at pos Removes the characters in the range (first, last) |
|
Find the first occurrence of a string within the string. Find the first occurrence of a character within the string. |
|
Find the first occurrence of a character not within the string. Find the first occurrence of any of the characters not within the string. Find the first occurrence of a character not equal to c. |
|
Find the first occurrence of any of the characters within the string. |
|
Find the last occurrence of a character not within the string. Find the last occurrence of a character not equal to c. |
|
Find the last occurrence of any of the characters within the string. |
|
Accesses the first character. |
|
Insert a character. Insert a string. Insert characters. Insert a range of characters. Insert characters from an initializer list. Insert characters from an object convertible to string_view_type. |
|
Returns the number of characters, excluding the null terminator. |
|
Returns the maximum number of characters that can be stored, excluding the null terminator. |
|
Convert a static string to a string_view_type |
|
Append to the string. |
|
Assign to the string. |
|
Access specified character. |
|
Removes the last character from the string. |
|
Appends the given character ch to the end of the string. |
|
Returns a reverse iterator to the beginning. |
|
Returns a reverse iterator to the end. |
|
Replace a substring with a string. Replace a substring with a substring. Replace a substring with an object convertible to string_view_type. Replace a substring with a substring of an object convertible to string_view_type. Replace a substring with copies of a character. Replace a range with a string. Replace a range with an object convertible to string_view_type. Replace a range with copies of a character. Replace a range with a range. Replace a range with an initializer list. |
|
Reserve space for n characters, excluding the null terminator. |
|
Change the size of the string. |
|
Find the last occurrence of a string within the string. Find the last occurrence of a character within the string. |
|
Reduces memory usage by freeing unused memory. |
|
Returns the number of characters, excluding the null terminator. |
|
Returns whether the string begins with s Returns whether the string begins with c |
|
Return a substring. |
|
Return a view of a substring. |
|
Exchange the contents of this string with another. |
Name |
Description |
---|---|
A special index. |
|
Maximum size of the string excluding any null terminator. |
These objects behave like std::string
except that the storage is not dynamically allocated but rather fixed in
size, and stored in the object itself. These strings offer performance advantages
when an algorithm can execute with a reasonable upper limit on the size of
a value.
The following alias templates are provided for convenience:
template<std::size_t N> using static_string = basic_static_string<N, char, std::char_traits<char>>;
template<std::size_t N> using static_wstring = basic_static_string<N, wchar_t, std::char_traits<wchar_t>>;
template<std::size_t N> using static_u16string = basic_static_string<N, char16_t, std::char_traits<char16_t>>;
template<std::size_t N> using static_u32string = basic_static_string<N, char32_t, std::char_traits<char32_t>>;
Addtionally, the alias static_u8string
is provided in C++20
using static_u8string = basic_static_string<N, char8_t, std::char_traits<char8_t>>;