ゴミ箱
|
#include <static_string.hpp>
Public Types | |
using | traits_type = Traits |
using | value_type = typename Traits::char_type |
using | size_type = std::size_t |
using | difference_type = std::ptrdiff_t |
using | pointer = value_type * |
using | reference = value_type & |
using | const_pointer = value_type const * |
using | const_reference = value_type const & |
using | iterator = value_type * |
using | const_iterator = value_type const * |
using | reverse_iterator = std::reverse_iterator< iterator > |
using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
using | string_view_type = basic_string_view< CharT, Traits > |
The type of string_view returned by the interface. More... | |
Public Member Functions | |
static_string () | |
Default constructor (empty string). More... | |
static_string (size_type count, CharT ch) | |
template<std::size_t M> | |
static_string (static_string< M, CharT, Traits > const &other, size_type pos) | |
Construct with a substring (pos, other.size()) of other . More... | |
template<std::size_t M> | |
static_string (static_string< M, CharT, Traits > const &other, size_type pos, size_type count) | |
Construct with a substring (pos, count) of other . More... | |
static_string (CharT const *s, size_type count) | |
Construct with the first count characters of s , including nulls. More... | |
static_string (CharT const *s) | |
Construct from a null terminated string. More... | |
template<class InputIt > | |
static_string (InputIt first, InputIt last) | |
Construct from a range of characters. More... | |
static_string (static_string const &other) | |
Copy constructor. More... | |
template<std::size_t M> | |
static_string (static_string< M, CharT, Traits > const &other) | |
Copy constructor. More... | |
static_string (std::initializer_list< CharT > init) | |
Construct from an initializer list. More... | |
static_string (string_view_type sv) | |
Construct from a string_view More... | |
template<class T , class = typename std::enable_if< std::is_convertible<T, string_view_type>::value>::type> | |
static_string (T const &t, size_type pos, size_type n) | |
static_string & | operator= (static_string const &str) |
Copy assignment. More... | |
template<std::size_t M> | |
static_string & | operator= (static_string< M, CharT, Traits > const &str) |
Copy assignment. More... | |
static_string & | operator= (CharT const *s) |
Assign from null-terminated string. More... | |
static_string & | operator= (CharT ch) |
Assign from single character. More... | |
static_string & | operator= (std::initializer_list< CharT > init) |
Assign from initializer list. More... | |
static_string & | operator= (string_view_type sv) |
Assign from string_view_type . More... | |
static_string & | assign (size_type count, CharT ch) |
Assign count copies of ch . More... | |
static_string & | assign (static_string const &str) |
Assign from another static_string More... | |
template<std::size_t M> | |
static_string & | assign (static_string< M, CharT, Traits > const &str) |
Assign from another static_string More... | |
template<std::size_t M> | |
static_string & | assign (static_string< M, CharT, Traits > const &str, size_type pos, size_type count=npos) |
Assign count characterss starting at npos from other . More... | |
static_string & | assign (CharT const *s, size_type count) |
Assign the first count characters of s , including nulls. More... | |
static_string & | assign (CharT const *s) |
Assign a null terminated string. More... | |
template<class InputIt > | |
static_string & | assign (InputIt first, InputIt last) |
Assign from an iterator range of characters. More... | |
static_string & | assign (std::initializer_list< CharT > init) |
Assign from initializer list. More... | |
static_string & | assign (string_view_type str) |
Assign from string_view_type . More... | |
template<class T > | |
std::enable_if< std::is_convertible< T, string_view_type >::value, static_string & >::type | assign (T const &t, size_type pos, size_type count=npos) |
reference | at (size_type pos) |
Access specified character with bounds checking. More... | |
const_reference | at (size_type pos) const |
Access specified character with bounds checking. More... | |
reference | operator[] (size_type pos) |
Access specified character. More... | |
const_reference | operator[] (size_type pos) const |
Access specified character. More... | |
CharT & | front () |
Accesses the first character. More... | |
CharT const & | front () const |
Accesses the first character. More... | |
CharT & | back () |
Accesses the last character. More... | |
CharT const & | back () const |
Accesses the last character. More... | |
CharT * | data () |
Returns a pointer to the first character of a string. More... | |
CharT const * | data () const |
Returns a pointer to the first character of a string. More... | |
CharT const * | c_str () const |
Returns a non-modifiable standard C character array version of the string. More... | |
operator string_view_type () const | |
Convert a static string to a string_view_type More... | |
iterator | begin () |
Returns an iterator to the beginning. More... | |
const_iterator | begin () const |
Returns an iterator to the beginning. More... | |
const_iterator | cbegin () const |
Returns an iterator to the beginning. More... | |
iterator | end () |
Returns an iterator to the end. More... | |
const_iterator | end () const |
Returns an iterator to the end. More... | |
const_iterator | cend () const |
Returns an iterator to the end. More... | |
reverse_iterator | rbegin () |
Returns a reverse iterator to the beginning. More... | |
const_reverse_iterator | rbegin () const |
Returns a reverse iterator to the beginning. More... | |
const_reverse_iterator | crbegin () const |
Returns a reverse iterator to the beginning. More... | |
reverse_iterator | rend () |
Returns a reverse iterator to the end. More... | |
const_reverse_iterator | rend () const |
Returns a reverse iterator to the end. More... | |
const_reverse_iterator | crend () const |
Returns a reverse iterator to the end. More... | |
bool | empty () const |
Returns true if the string is empty. More... | |
size_type | size () const |
Returns the number of characters, excluding the null terminator. More... | |
size_type | length () const |
Returns the number of characters, excluding the null terminator. More... | |
size_type constexpr | max_size () const |
Returns the maximum number of characters that can be stored, excluding the null terminator. More... | |
void | reserve (std::size_t n) |
size_type constexpr | capacity () const |
Returns the number of characters that can be held in currently allocated storage. More... | |
void | shrink_to_fit () |
void | clear () |
Clears the contents. More... | |
static_string & | insert (size_type index, size_type count, CharT ch) |
static_string & | insert (size_type index, CharT const *s) |
static_string & | insert (size_type index, CharT const *s, size_type count) |
template<std::size_t M> | |
static_string & | insert (size_type index, static_string< M, CharT, Traits > const &str) |
template<std::size_t M> | |
static_string & | insert (size_type index, static_string< M, CharT, Traits > const &str, size_type index_str, size_type count=npos) |
iterator | insert (const_iterator pos, CharT ch) |
iterator | insert (const_iterator pos, size_type count, CharT ch) |
template<class InputIt > | |
std::enable_if< detail::is_input_iterator< InputIt >::value, iterator >::type | insert (const_iterator pos, InputIt first, InputIt last) |
iterator | insert (const_iterator pos, std::initializer_list< CharT > init) |
static_string & | insert (size_type index, string_view_type str) |
template<class T > | |
std::enable_if< std::is_convertible< T const &, string_view_type >::value &&!std::is_convertible< T const &, CharT const * >::value, static_string & >::type | insert (size_type index, T const &t, size_type index_str, size_type count=npos) |
static_string & | erase (size_type index=0, size_type count=npos) |
iterator | erase (const_iterator pos) |
iterator | erase (const_iterator first, const_iterator last) |
void | push_back (CharT ch) |
void | pop_back () |
static_string & | append (size_type count, CharT ch) |
template<std::size_t M> | |
static_string & | append (static_string< M, CharT, Traits > const &str) |
template<std::size_t M> | |
static_string & | append (static_string< M, CharT, Traits > const &str, size_type pos, size_type count=npos) |
static_string & | append (CharT const *s, size_type count) |
static_string & | append (CharT const *s) |
template<class InputIt > | |
std::enable_if< detail::is_input_iterator< InputIt >::value, static_string & >::type | append (InputIt first, InputIt last) |
static_string & | append (std::initializer_list< CharT > init) |
static_string & | append (string_view_type sv) |
template<class T > | |
std::enable_if< std::is_convertible< T const &, string_view_type >::value &&!std::is_convertible< T const &, CharT const * >::value, static_string & >::type | append (T const &t, size_type pos, size_type count=npos) |
template<std::size_t M> | |
static_string & | operator+= (static_string< M, CharT, Traits > const &str) |
static_string & | operator+= (CharT ch) |
static_string & | operator+= (CharT const *s) |
static_string & | operator+= (std::initializer_list< CharT > init) |
static_string & | operator+= (string_view_type const &str) |
template<std::size_t M> | |
int | compare (static_string< M, CharT, Traits > const &str) const |
template<std::size_t M> | |
int | compare (size_type pos1, size_type count1, static_string< M, CharT, Traits > const &str) const |
template<std::size_t M> | |
int | compare (size_type pos1, size_type count1, static_string< M, CharT, Traits > const &str, size_type pos2, size_type count2=npos) const |
int | compare (CharT const *s) const |
int | compare (size_type pos1, size_type count1, CharT const *s) const |
int | compare (size_type pos1, size_type count1, CharT const *s, size_type count2) const |
int | compare (string_view_type str) const |
int | compare (size_type pos1, size_type count1, string_view_type str) const |
template<class T > | |
std::enable_if< std::is_convertible< T const &, string_view_type >::value &&!std::is_convertible< T const &, CharT const * >::value, int >::type | compare (size_type pos1, size_type count1, T const &t, size_type pos2, size_type count2=npos) const |
string_view_type | substr (size_type pos=0, size_type count=npos) const |
size_type | copy (CharT *dest, size_type count, size_type pos=0) const |
Copy a substring (pos, pos+count) to character string pointed to by dest . More... | |
void | resize (std::size_t n) |
void | resize (std::size_t n, CharT c) |
void | swap (static_string &str) |
Exchange the contents of this string with another. More... | |
template<std::size_t M> | |
void | swap (static_string< M, CharT, Traits > &str) |
Exchange the contents of this string with another. More... | |
template<std::size_t M> | |
auto | assign (static_string< M, CharT, Traits > const &str, size_type pos, size_type count) -> static_string & |
template<class InputIt> | |
auto | assign (InputIt first, InputIt last) -> static_string & |
template<class T> | |
auto | assign (T const &t, size_type pos, size_type count) -> typename std::enable_if< std::is_convertible< T, string_view_type >::value, static_string & >::type |
template<std::size_t M> | |
auto | insert (size_type index, static_string< M, CharT, Traits > const &str, size_type index_str, size_type count) -> static_string & |
template<class InputIt> | |
auto | insert (const_iterator pos, InputIt first, InputIt last) -> typename std::enable_if< detail::is_input_iterator< InputIt >::value, iterator >::type |
template<class T> | |
auto | insert (size_type index, const T &t, size_type index_str, size_type count) -> typename std::enable_if< std::is_convertible< T const &, string_view_type >::value && !std::is_convertible< T const &, CharT const * >::value, static_string & >::type |
template<std::size_t M> | |
auto | append (static_string< M, CharT, Traits > const &str, size_type pos, size_type count) -> static_string & |
Static Public Attributes | |
static std::size_t constexpr | max_size_n = N |
Maximum size of the string excluding the null terminator. More... | |
static constexpr size_type | npos = size_type(-1) |
A special index. More... | |
Friends | |
template<std::size_t , class , class > | |
class | static_string |
A modifiable string with a fixed-size storage area.
These objects behave like std::string
except that the storage is not dynamically allocated but rather fixed in size.
These strings offer performance advantages when a protocol imposes a natural small upper limit on the size of a value.
using boost::beast::static_string< N, CharT, Traits >::const_iterator = value_type const* |
using boost::beast::static_string< N, CharT, Traits >::const_pointer = value_type const* |
using boost::beast::static_string< N, CharT, Traits >::const_reference = value_type const& |
using boost::beast::static_string< N, CharT, Traits >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
using boost::beast::static_string< N, CharT, Traits >::difference_type = std::ptrdiff_t |
using boost::beast::static_string< N, CharT, Traits >::iterator = value_type* |
using boost::beast::static_string< N, CharT, Traits >::pointer = value_type* |
using boost::beast::static_string< N, CharT, Traits >::reference = value_type& |
using boost::beast::static_string< N, CharT, Traits >::reverse_iterator = std::reverse_iterator<iterator> |
using boost::beast::static_string< N, CharT, Traits >::size_type = std::size_t |
using boost::beast::static_string< N, CharT, Traits >::string_view_type = basic_string_view<CharT, Traits> |
The type of string_view
returned by the interface.
using boost::beast::static_string< N, CharT, Traits >::traits_type = Traits |
using boost::beast::static_string< N, CharT, Traits >::value_type = typename Traits::char_type |
boost::beast::static_string< N, CharT, Traits >::static_string | ( | ) |
Default constructor (empty string).
boost::beast::static_string< N, CharT, Traits >::static_string | ( | size_type | count, |
CharT | ch | ||
) |
Construct with count copies of character ch
.
The behavior is undefined if count >= npos
boost::beast::static_string< N, CharT, Traits >::static_string | ( | static_string< M, CharT, Traits > const & | other, |
size_type | pos | ||
) |
Construct with a substring (pos, other.size()) of other
.
boost::beast::static_string< N, CharT, Traits >::static_string | ( | static_string< M, CharT, Traits > const & | other, |
size_type | pos, | ||
size_type | count | ||
) |
Construct with a substring (pos, count) of other
.
boost::beast::static_string< N, CharT, Traits >::static_string | ( | CharT const * | s, |
size_type | count | ||
) |
Construct with the first count
characters of s
, including nulls.
boost::beast::static_string< N, CharT, Traits >::static_string | ( | CharT const * | s | ) |
Construct from a null terminated string.
boost::beast::static_string< N, CharT, Traits >::static_string | ( | InputIt | first, |
InputIt | last | ||
) |
Construct from a range of characters.
boost::beast::static_string< N, CharT, Traits >::static_string | ( | static_string< N, CharT, Traits > const & | other | ) |
Copy constructor.
boost::beast::static_string< N, CharT, Traits >::static_string | ( | static_string< M, CharT, Traits > const & | other | ) |
Copy constructor.
boost::beast::static_string< N, CharT, Traits >::static_string | ( | std::initializer_list< CharT > | init | ) |
Construct from an initializer list.
|
explicit |
Construct from a string_view
boost::beast::static_string< N, CharT, Traits >::static_string | ( | T const & | t, |
size_type | pos, | ||
size_type | n | ||
) |
Construct from any object convertible to string_view_type
.
The range (pos, n) is extracted from the value obtained by converting t
to string_view_type
, and used to construct the string.
auto boost::beast::static_string< N, CharT, Traits >::append | ( | static_string< M, CharT, Traits > const & | str, |
size_type | pos, | ||
size_type | count | ||
) | -> static_string& |
|
inline |
|
inline |
static_string& boost::beast::static_string< N, CharT, Traits >::append | ( | static_string< M, CharT, Traits > const & | str, |
size_type | pos, | ||
size_type | count = npos |
||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
auto boost::beast::static_string< N, CharT, Traits >::assign | ( | static_string< M, CharT, Traits > const & | str, |
size_type | pos, | ||
size_type | count | ||
) | -> static_string& |
auto boost::beast::static_string< N, CharT, Traits >::assign | ( | InputIt | first, |
InputIt | last | ||
) | -> static_string& |
auto boost::beast::static_string< N, CharT, Traits >::assign | ( | T const & | t, |
size_type | pos, | ||
size_type | count | ||
) | -> typename std::enable_if<std::is_convertible<T, string_view_type>::value, static_string&>::type |
auto boost::beast::static_string< N, CharT, Traits >::assign | ( | size_type | count, |
CharT | ch | ||
) |
Assign count
copies of ch
.
auto boost::beast::static_string< N, CharT, Traits >::assign | ( | static_string< N, CharT, Traits > const & | str | ) |
Assign from another static_string
|
inline |
Assign from another static_string
static_string& boost::beast::static_string< N, CharT, Traits >::assign | ( | static_string< M, CharT, Traits > const & | str, |
size_type | pos, | ||
size_type | count = npos |
||
) |
Assign count
characterss starting at npos
from other
.
auto boost::beast::static_string< N, CharT, Traits >::assign | ( | CharT const * | s, |
size_type | count | ||
) |
Assign the first count
characters of s
, including nulls.
|
inline |
Assign a null terminated string.
static_string& boost::beast::static_string< N, CharT, Traits >::assign | ( | InputIt | first, |
InputIt | last | ||
) |
Assign from an iterator range of characters.
|
inline |
Assign from initializer list.
|
inline |
Assign from string_view_type
.
std::enable_if<std::is_convertible<T, string_view_type>::value, static_string&>::type boost::beast::static_string< N, CharT, Traits >::assign | ( | T const & | t, |
size_type | pos, | ||
size_type | count = npos |
||
) |
Assign from any object convertible to string_view_type
.
The range (pos, n) is extracted from the value obtained by converting t
to string_view_type
, and used to assign the string.
auto boost::beast::static_string< N, CharT, Traits >::at | ( | size_type | pos | ) |
Access specified character with bounds checking.
auto boost::beast::static_string< N, CharT, Traits >::at | ( | size_type | pos | ) | const |
Access specified character with bounds checking.
|
inline |
Accesses the last character.
|
inline |
Accesses the last character.
|
inline |
Returns an iterator to the beginning.
|
inline |
Returns an iterator to the beginning.
|
inline |
Returns a non-modifiable standard C character array version of the string.
|
inline |
Returns the number of characters that can be held in currently allocated storage.
|
inline |
Returns an iterator to the beginning.
|
inline |
Returns an iterator to the end.
void boost::beast::static_string< N, CharT, Traits >::clear | ( | ) |
Clears the contents.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
auto boost::beast::static_string< N, CharT, Traits >::copy | ( | CharT * | dest, |
size_type | count, | ||
size_type | pos = 0 |
||
) | const |
Copy a substring (pos, pos+count) to character string pointed to by dest
.
|
inline |
Returns a reverse iterator to the beginning.
|
inline |
Returns a reverse iterator to the end.
|
inline |
Returns a pointer to the first character of a string.
|
inline |
Returns a pointer to the first character of a string.
|
inline |
Returns true
if the string is empty.
|
inline |
Returns an iterator to the end.
|
inline |
Returns an iterator to the end.
auto boost::beast::static_string< N, CharT, Traits >::erase | ( | size_type | index = 0 , |
size_type | count = npos |
||
) |
auto boost::beast::static_string< N, CharT, Traits >::erase | ( | const_iterator | pos | ) |
auto boost::beast::static_string< N, CharT, Traits >::erase | ( | const_iterator | first, |
const_iterator | last | ||
) |
|
inline |
Accesses the first character.
|
inline |
Accesses the first character.
auto boost::beast::static_string< N, CharT, Traits >::insert | ( | size_type | index, |
static_string< M, CharT, Traits > const & | str, | ||
size_type | index_str, | ||
size_type | count | ||
) | -> static_string& |
auto boost::beast::static_string< N, CharT, Traits >::insert | ( | const_iterator | pos, |
InputIt | first, | ||
InputIt | last | ||
) | -> typename std::enable_if< detail::is_input_iterator<InputIt>::value, iterator>::type |
auto boost::beast::static_string< N, CharT, Traits >::insert | ( | size_type | index, |
const T & | t, | ||
size_type | index_str, | ||
size_type | count | ||
) | -> typename std::enable_if<std::is_convertible< T const&, string_view_type>::value && ! std::is_convertible<T const&, CharT const*>::value, static_string&>::type |
auto boost::beast::static_string< N, CharT, Traits >::insert | ( | size_type | index, |
size_type | count, | ||
CharT | ch | ||
) |
|
inline |
auto boost::beast::static_string< N, CharT, Traits >::insert | ( | size_type | index, |
CharT const * | s, | ||
size_type | count | ||
) |
|
inline |
static_string& boost::beast::static_string< N, CharT, Traits >::insert | ( | size_type | index, |
static_string< M, CharT, Traits > const & | str, | ||
size_type | index_str, | ||
size_type | count = npos |
||
) |
|
inline |
auto boost::beast::static_string< N, CharT, Traits >::insert | ( | const_iterator | pos, |
size_type | count, | ||
CharT | ch | ||
) |
std::enable_if< detail::is_input_iterator<InputIt>::value, iterator>::type boost::beast::static_string< N, CharT, Traits >::insert | ( | const_iterator | pos, |
InputIt | first, | ||
InputIt | last | ||
) |
|
inline |
|
inline |
std::enable_if< std::is_convertible<T const&, string_view_type>::value && ! std::is_convertible<T const&, CharT const*>::value, static_string&>::type boost::beast::static_string< N, CharT, Traits >::insert | ( | size_type | index, |
T const & | t, | ||
size_type | index_str, | ||
size_type | count = npos |
||
) |
|
inline |
Returns the number of characters, excluding the null terminator.
|
inline |
Returns the maximum number of characters that can be stored, excluding the null terminator.
|
inline |
Convert a static string to a string_view_type
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Copy assignment.
|
inline |
Copy assignment.
|
inline |
Assign from null-terminated string.
|
inline |
Assign from single character.
|
inline |
Assign from initializer list.
|
inline |
Assign from string_view_type
.
|
inline |
Access specified character.
|
inline |
Access specified character.
|
inline |
void boost::beast::static_string< N, CharT, Traits >::push_back | ( | CharT | ch | ) |
|
inline |
Returns a reverse iterator to the beginning.
|
inline |
Returns a reverse iterator to the beginning.
|
inline |
Returns a reverse iterator to the end.
|
inline |
Returns a reverse iterator to the end.
void boost::beast::static_string< N, CharT, Traits >::reserve | ( | std::size_t | n | ) |
Reserves storage.
This actually just throws an exception if n > N
, otherwise does nothing since the storage is fixed.
void boost::beast::static_string< N, CharT, Traits >::resize | ( | std::size_t | n | ) |
Changes the number of characters stored.
If the resulting string is larger, the new characters are uninitialized.
void boost::beast::static_string< N, CharT, Traits >::resize | ( | std::size_t | n, |
CharT | c | ||
) |
Changes the number of characters stored.
If the resulting string is larger, the new characters are initialized to the value of c
.
|
inline |
Reduces memory usage by freeing unused memory.
This actually does nothing, since the storage is fixed.
|
inline |
Returns the number of characters, excluding the null terminator.
auto boost::beast::static_string< N, CharT, Traits >::substr | ( | size_type | pos = 0 , |
size_type | count = npos |
||
) | const |
void boost::beast::static_string< N, CharT, Traits >::swap | ( | static_string< N, CharT, Traits > & | str | ) |
Exchange the contents of this string with another.
void boost::beast::static_string< N, CharT, Traits >::swap | ( | static_string< M, CharT, Traits > & | str | ) |
Exchange the contents of this string with another.
|
friend |
|
static |
Maximum size of the string excluding the null terminator.
|
static |
A special index.