xentara-utils v2.0.4
The Xentara Utility Library
|
A string that uses a statically allocated buffer for the data. More...
#include <xentara/utils/string/StaticString.hpp>
Classes | |
class | RawData |
An object that enables low-level access to the string’s data and size. More... | |
Public Types | |
using | traits_type = CharTraits |
The character traits. | |
using | value_type = Char |
The character type. | |
using | size_type = std::size_t |
The type used for sizes. | |
using | difference_type = std::ptrdiff_t |
The type used for distances. | |
using | reference = value_type & |
A reference to an character. | |
using | const_reference = const value_type & |
A const reference to an character. | |
using | pointer = value_type * |
A pointer to an character. | |
using | const_pointer = const value_type * |
A const pointer to an character. | |
using | iterator = core::ContiguousIterator< pointer, BasicStaticString > |
An iterator. | |
using | const_iterator = core::ContiguousIterator< const_pointer, BasicStaticString > |
A const iterator. | |
using | reverse_iterator = std::reverse_iterator< iterator > |
An iterator for iterating in reverse order. | |
using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
A const iterator for iterating in reverse order. | |
Public Member Functions | |
Constructors | |
constexpr | BasicStaticString () noexcept |
Default constructor. | |
constexpr | BasicStaticString (const BasicStaticString &) noexcept=default |
Copy constructor. | |
constexpr | BasicStaticString (size_type count, Char character) |
Constructor for a string filled with a specific character. | |
constexpr | BasicStaticString (const BasicStaticString &string, size_type position, size_type count=npos) |
Constructor that copies a sub string of another static string with the same capacity. | |
constexpr | BasicStaticString (const Char *string, size_type count) |
Constructor that copies characters from an array. | |
constexpr | BasicStaticString (const Char *string) |
Constructor that copies a null-terminated string. | |
template<std::input_iterator InputIterator> | |
constexpr | BasicStaticString (InputIterator first, InputIterator last) |
Constructor that fills the string from a character sequence. | |
BasicStaticString (std::initializer_list< Char > characters) | |
Constructor that initializes the characters from an initializer list. | |
template<typename String > requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>) | |
constexpr | BasicStaticString (const String &string) |
Constructor that copies an arbitrary string. | |
template<typename String > requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>) | |
constexpr | BasicStaticString (const String &string, size_type position, size_type count) |
Constructor that copies a sub string of a string. | |
Assigning Values | |
constexpr auto | operator= (const BasicStaticString &) noexcept -> BasicStaticString &=default |
Copy assignment operator. | |
constexpr auto | operator= (Char character) -> BasicStaticString & |
Assignment operator for a single character. | |
constexpr auto | operator= (const Char *string) -> BasicStaticString & |
Assignment operator for a null-terminated string. | |
constexpr auto | operator= (std::initializer_list< Char > characters) -> BasicStaticString & |
Assignment operator for an initializer list. | |
template<typename String > requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>) | |
constexpr auto | operator= (const String &string) -> BasicStaticString & |
Assignment operator for an arbitrary string. | |
constexpr auto | assign (size_type count, Char character) -> BasicStaticString & |
Fills the string with a specific character. | |
constexpr auto | assign (const BasicStaticString &string) noexcept -> BasicStaticString & |
Copies another static string of the same capacity. | |
constexpr auto | assign (const BasicStaticString &string, size_type position, size_type count=npos) noexcept -> BasicStaticString & |
Copies a sub string of another static string of the same capacity. | |
constexpr auto | assign (const Char *string, size_type count) -> BasicStaticString & |
Copies characters from an array. | |
constexpr auto | assign (const Char *string) -> BasicStaticString & |
Copies a null-terminated string. | |
template<std::input_iterator InputIterator> | |
constexpr auto | assign (InputIterator first, InputIterator last) -> BasicStaticString & |
Copies a character range. | |
constexpr auto | assign (std::initializer_list< Char > characters) -> BasicStaticString & |
Copies the characters from an initializer list. | |
template<typename String > requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>) | |
constexpr auto | assign (const String &string) -> BasicStaticString & |
Copies an arbitrary string. | |
template<typename String > requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>) | |
constexpr auto | assign (const String &string, size_type position, size_type count=npos) -> BasicStaticString & |
Copies a sub string of a string, up to a maximum length. | |
Character Access | |
constexpr | operator std::basic_string_view< Char, CharTraits > () const noexcept |
conversion to a string view | |
template<typename Allocator > | |
constexpr | operator std::basic_string< Char, CharTraits, Allocator > () const noexcept |
conversion to an std::string | |
constexpr auto | view () const noexcept -> std::basic_string_view< Char, CharTraits > |
Gets the data as a string view. | |
template<typename Allocator = std::allocator<Char>> | |
constexpr auto | str (const Allocator &allocator=Allocator()) const noexcept -> std::basic_string< Char, CharTraits, Allocator > |
Gets the data as an std::string. | |
constexpr auto | at (size_type index) const -> const_reference |
Accesses the character at a certain index. | |
constexpr auto | at (size_type index) -> reference |
Accesses the character at a certain index. | |
constexpr auto | operator[] (size_type index) const noexcept -> const_reference |
Subscript operator. | |
constexpr auto | operator[] (size_type index) noexcept -> reference |
Subscript operator. | |
constexpr auto | front () const noexcept -> const_reference |
Returns the first character. | |
constexpr auto | front () noexcept -> reference |
Returns the first character. | |
constexpr auto | back () const noexcept -> const_reference |
Returns the last character. | |
constexpr auto | back () noexcept -> reference |
Returns the last character. | |
constexpr auto | data () const noexcept -> const Char * |
Gets a pointer to the data. | |
constexpr auto | data () noexcept -> Char * |
Gets a pointer to the data. | |
constexpr auto | c_str () const noexcept -> const Char * |
Gets the data as a null terminated string. | |
Iterators | |
constexpr auto | begin () noexcept -> iterator |
Creates a begin iterator. | |
constexpr auto | begin () const noexcept -> const_iterator |
Creates a begin iterator. | |
constexpr auto | cbegin () const noexcept -> const_iterator |
Creates a begin iterator. | |
constexpr auto | end () noexcept -> iterator |
Creates an end iterator. | |
constexpr auto | end () const noexcept -> const_iterator |
Creates an end iterator. | |
constexpr auto | cend () const noexcept -> const_iterator |
Creates an end iterator. | |
constexpr auto | rbegin () noexcept -> reverse_iterator |
Creates a reverse begin iterator. | |
constexpr auto | rbegin () const noexcept -> const_reverse_iterator |
Creates a reverse begin iterator. | |
constexpr auto | crbegin () const noexcept -> const_reverse_iterator |
Creates a reverse begin iterator. | |
constexpr auto | rend () noexcept -> reverse_iterator |
Creates a reverse end iterator. | |
constexpr auto | rend () const noexcept -> const_reverse_iterator |
Creates a reverse end iterator. | |
constexpr auto | crend () const noexcept -> const_reverse_iterator |
Creates a reverse end iterator. | |
Finding Sub Strings | |
constexpr auto | starts_with (std::basic_string_view< Char, CharTraits > string) const noexcept -> bool |
Checks whether the string starts with a certain text. | |
constexpr auto | starts_with (Char character) const noexcept -> bool |
Checks whether the string starts with a certain character. | |
constexpr auto | starts_with (const Char *string) const -> bool |
Checks whether the string starts with a certain text. | |
constexpr auto | ends_with (std::basic_string_view< Char, CharTraits > string) const noexcept -> bool |
Checks whether the string ends with a certain text. | |
constexpr auto | ends_with (Char character) const noexcept -> bool |
Checks whether the string ends with a certain character. | |
constexpr auto | ends_with (const Char *string) const -> bool |
Checks whether the string ends with a certain text. | |
Modifiers | |
constexpr auto | resize (size_type newSize) noexcept -> void |
Resizes the string. | |
constexpr auto | resize (size_type newSize, Char padding) noexcept -> void |
Resizes the string. | |
constexpr auto | clear () noexcept -> void |
Clears the string. | |
Appending characters | |
constexpr auto | operator+= (const BasicStaticString &string) -> BasicStaticString & |
Appends another static string of the same capacity to the string. | |
constexpr auto | operator+= (Char character) -> BasicStaticString & |
Appends a single character to the string. | |
constexpr auto | operator+= (const Char *string) -> BasicStaticString & |
Appends a null-terminated string to the string. | |
constexpr auto | operator+= (std::initializer_list< Char > characters) -> BasicStaticString & |
Appends the characters from an initializer list to the string. | |
template<typename String > requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>) | |
constexpr auto | operator+= (const String &string) -> BasicStaticString & |
Appends an arbitrary string to the string. | |
constexpr auto | push_back (Char character) -> void |
Appends a single character to the string. | |
constexpr auto | append (size_type count, Char character) -> BasicStaticString & |
Appends a number of copies of a character to the string. | |
constexpr auto | append (const BasicStaticString &string) -> BasicStaticString & |
Appends another static string of the same capacity to the string. | |
constexpr auto | append (const BasicStaticString &string, size_type position, size_type count=npos) -> BasicStaticString & |
Appends a sub string of another static string of the same capacity to the string. | |
constexpr auto | append (const Char *string, size_type count) -> BasicStaticString & |
Appends characters from an array to the string. | |
constexpr auto | append (const Char *string) -> BasicStaticString & |
Appends a null-terminated string to the string. | |
template<std::input_iterator InputIterator> | |
constexpr auto | append (InputIterator first, InputIterator last) -> BasicStaticString & |
Appends a character sequence to the string. | |
constexpr auto | append (std::initializer_list< Char > characters) -> BasicStaticString & |
Appends the characters from an initializer list to the string. | |
template<typename String > requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>) | |
constexpr auto | append (const String &string) -> BasicStaticString & |
Appends an arbitrary string to the string. | |
template<typename String > requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>) | |
constexpr auto | append (const String &string, size_type position, size_type count=npos) -> BasicStaticString & |
Appends a sub string of a string, up to a maximum length to the string. | |
Inserting characters | |
constexpr auto | insert (size_type where, size_type count, Char character) -> BasicStaticString & |
Inserts a number of copies of a character into the string. | |
constexpr auto | insert (size_type where, const Char *string) -> BasicStaticString & |
Inserts a null-terminated string into the string. | |
constexpr auto | insert (size_type where, const Char *string, size_type count) -> BasicStaticString & |
Inserts characters from an array into the string. | |
constexpr auto | insert (size_type where, const BasicStaticString &string) -> BasicStaticString & |
Inserts another static string of the same capacity into the string. | |
constexpr auto | insert (size_type where, const BasicStaticString &string, size_type position, size_type count=npos) -> BasicStaticString & |
Inserts a sub string of another static string of the same capacity into the string. | |
template<typename String > requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>) | |
constexpr auto | insert (size_type where, const String &string) -> BasicStaticString & |
Inserts an arbitrary string into the string. | |
template<typename String > requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>) | |
constexpr auto | insert (size_type where, const String &string, size_type position, size_type count=npos) -> BasicStaticString & |
Inserts a sub string of a string, up to a maximum length into the string. | |
constexpr auto | insert (const_iterator where, Char character) -> iterator |
Inserts a single character into the string. | |
constexpr auto | insert (const_iterator where, size_type count, Char character) -> iterator |
Inserts a number of copies of a character into the string. | |
template<std::input_iterator InputIterator> | |
constexpr auto | insert (const_iterator where, InputIterator first, InputIterator last) -> iterator |
Inserts a character sequence into the string. | |
constexpr auto | insert (const_iterator where, std::initializer_list< Char > characters) -> iterator |
Inserts the characters from an initializer list into the string. | |
Removing characters | |
constexpr auto | pop_back () noexcept -> void |
Removes the last character of the string. | |
constexpr auto | erase (size_type index=0, size_type count=npos) -> BasicStaticString & |
Removes characters from the string. | |
constexpr auto | erase (const_iterator position) noexcept -> iterator |
Removes a single character from the string. | |
constexpr auto | erase (const_iterator first, const_iterator last) noexcept -> iterator |
Removes a range of characters from the string. | |
Low-Level Access | |
constexpr auto | rawData () noexcept -> RawData |
Returns an object that allows you to access to the string’s data and size directly. | |
Static Public Attributes | |
static constexpr size_type | npos |
Special size value used for automatically determined lengths. | |
Size and Capacity | |
constexpr auto | empty () const noexcept -> bool |
Determines whether the string is empty. | |
constexpr auto | size () const noexcept -> size_type |
Gets the current size. | |
constexpr auto | length () const noexcept -> size_type |
Alias for size() | |
constexpr auto | capacity () const noexcept -> size_type |
Gets the capacity of the string. | |
static constexpr auto | max_size () noexcept -> size_type |
Gets the maximum size. | |
A string that uses a statically allocated buffer for the data.
This class behaves just like std::string, but doesn't require any heap allocation. Instead, the string data is allocated in a static buffer of a fixed size.
Char | The character type |
kCapacity | The capacity of the string |
CharTraits | The char traits used for interacting with the standard C++ library |
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::const_iterator = core::ContiguousIterator<const_pointer, BasicStaticString> |
A const iterator.
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::const_pointer = const value_type * |
A const pointer to an character.
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::const_reference = const value_type & |
A const reference to an character.
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
A const iterator for iterating in reverse order.
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::difference_type = std::ptrdiff_t |
The type used for distances.
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::iterator = core::ContiguousIterator<pointer, BasicStaticString> |
An iterator.
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::pointer = value_type * |
A pointer to an character.
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::reference = value_type & |
A reference to an character.
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::reverse_iterator = std::reverse_iterator<iterator> |
An iterator for iterating in reverse order.
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::size_type = std::size_t |
The type used for sizes.
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::traits_type = CharTraits |
The character traits.
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::value_type = Char |
The character type.
|
constexprnoexcept |
Default constructor.
This constructor constructs an empty string.
|
constexprdefaultnoexcept |
Copy constructor.
|
constexpr |
Constructor for a string filled with a specific character.
count | The number of repetitions of the character. This must not exceed kCapacity. |
character | The character to fill the string with. |
std::length_error | count is greater than kCapacity. |
|
constexpr |
Constructor that copies a sub string of another static string with the same capacity.
string | The string to copy from. |
position | The position of the sub string to copy. Must be a valid sub string position within string, meaning it must be between 0 and the string.size(), inclusively. |
count | The maximum length of the sub string to copy, or npos to always copy the remainder of the string. The length of the sub string is calculated in the same way as std::basic_string_view::substr(). |
std::out_of_range | position is greater than the size of string. |
|
constexpr |
Constructor that copies characters from an array.
string | A pointer to the characters to copy. The pointer must point to a memory region that is at least count characters long. |
count | The number of characters to copy. This must not exceed kCapacity. |
std::length_error | count is greater than kCapacity. |
|
constexpr |
Constructor that copies a null-terminated string.
string | The string to copy. The string must be null-terminated, and must be no more than kCapacity character long. |
std::length_error | The length of the string is greater than kCapacity. |
|
constexpr |
Constructor that fills the string from a character sequence.
first | An iterator pointing to the first character to copy. |
last | An iterator pointing one position past the last character to copy. There must be no more than kCapacity characters between first and last. |
std::length_error | The length of the sequence [first, last) is greater than kCapacity. |
xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::BasicStaticString | ( | std::initializer_list< Char > | characters | ) |
Constructor that initializes the characters from an initializer list.
characters | The characters to initialize the string with. The size of the initializer list must not exceed kCapacity. |
std::length_error | The size of the initializer list is greater than kCapacity. |
|
explicitconstexpr |
Constructor that copies an arbitrary string.
String | The string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>. |
string | The string to copy. The size of the string must not exceed kCapacity. |
std::length_error | The size of the string is greater than kCapacity. |
|
constexpr |
Constructor that copies a sub string of a string.
String | The string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>. |
string | The string to copy from. |
position | The position of the sub string to copy. Must be a valid sub string position within string, meaning it must be between 0 and the size of the string contained in string, inclusively. |
count | The maximum length of the sub string to copy, or npos to always copy the remainder of the string. The length of the sub string is calculated in the same way as std::basic_string_view::substr(). Irrespective of the value of count, the effective length of the sub string must not exceed kCapacity. |
std::out_of_range | position is greater than the size of the string contained in string. |
std::length_error | The effective length of the sub string is greater than kCapacity. |
|
constexpr |
Appends another static string of the same capacity to the string.
string | The string to append. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Appends a sub string of another static string of the same capacity to the string.
string | The string to append from. |
position | The position of the sub string to append. Must be a valid sub string position within string, meaning it must be between 0 and the string.size(), inclusively. |
count | The maximum length of the sub string to append, or npos to always copy the remainder of the string. |
std::out_of_range | position is greater than the size of string. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Appends a null-terminated string to the string.
string | The string to append. The string must be null-terminated. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Appends characters from an array to the string.
string | A pointer to the characters to append. The pointer must point to a memory region that is at least count characters long. |
count | The number of characters to append. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Appends an arbitrary string to the string.
String | The string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>. |
string | The string to append. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Appends a sub string of a string, up to a maximum length to the string.
String | The string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>. |
string | The string to append from. |
position | The position of the sub string to append. Must be a valid sub string position within string, meaning it must be between 0 and the size of the string contained in string, inclusively. |
count | The maximum length of the sub string to append, or npos to always copy the remainder of the string. The length of the sub string is calculated in the same way as std::basic_string_view::substr(). |
std::out_of_range | position is greater than the size of the string contained in string. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Appends a character sequence to the string.
first | An iterator pointing to the first character to append. |
last | An iterator pointing one position past the last character to append. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Appends a number of copies of a character to the string.
count | The number of repetitions of the character. |
character | The character to append. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Appends the characters from an initializer list to the string.
characters | The characters to initialize the string with. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexprnoexcept |
Copies another static string of the same capacity.
|
constexprnoexcept |
Copies a sub string of another static string of the same capacity.
string | The string to copy from. |
position | The position of the sub string to copy. Must be a valid sub string position within string, meaning it must be between 0 and the string.size(), inclusively. |
count | The maximum length of the sub string to copy, or npos to always copy the remainder of the string. The length of the sub string is calculated in the same way as std::basic_string_view::substr(). |
std::out_of_range | position is greater than the size of string. |
|
constexpr |
Copies a null-terminated string.
string | The string to copy. The string must be null-terminated, and must be no more than kCapacity character long. |
std::length_error | The length of the string is greater than kCapacity. |
|
constexpr |
Copies characters from an array.
string | A pointer to the characters to copy. The pointer must point to a memory region that is at least count characters long. |
count | The number of characters to copy. This must not exceed kCapacity. |
std::length_error | count is greater than kCapacity. |
|
constexpr |
Copies an arbitrary string.
String | The string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>. |
string | The string to copy. The size of the string must not exceed kCapacity. |
std::length_error | The size of the string is greater than kCapacity. |
|
constexpr |
Copies a sub string of a string, up to a maximum length.
String | The string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>. |
string | The string to copy from. |
position | The position of the sub string to copy. Must be a valid sub string position within string, meaning it must be between 0 and the size of the string contained in string, inclusively. |
count | The maximum length of the sub string to copy, or npos to always copy the remainder of the string. The length of the sub string is calculated in the same way as std::basic_string_view::substr(). Irrespective of the value of count, the effective length of the sub string must not exceed kCapacity. |
std::out_of_range | position is greater than the size of the string contained in string. |
std::length_error | The effective length of the sub string is greater than kCapacity. |
|
constexpr |
Copies a character range.
first | An iterator pointing to the first character to copy. |
last | An iterator pointing one position past the last character to copy. There must be no more than kCapacity characters between begin and last. |
std::length_error | The length of the sequence [first, last) is greater than kCapacity. |
|
constexpr |
Fills the string with a specific character.
count | The number of repetitions of the character. This must not exceed kCapacity. |
character | The character to fill the string with. |
std::length_error | count is greater than kCapacity. |
|
constexpr |
Copies the characters from an initializer list.
characters | The characters to initialize the string with. The size of the initializer list must not exceed kCapacity. |
std::length_error | The size of the initializer list is greater than kCapacity. |
|
constexpr |
Accesses the character at a certain index.
index | The index |
std::out_of_range | index is out of range |
|
constexpr |
Accesses the character at a certain index.
index | The index |
std::out_of_range | index is out of range |
|
constexprnoexcept |
Returns the last character.
|
constexprnoexcept |
Returns the last character.
|
constexprnoexcept |
Creates a begin iterator.
|
constexprnoexcept |
Creates a begin iterator.
|
constexprnoexcept |
Gets the data as a null terminated string.
|
constexprnoexcept |
Gets the capacity of the string.
|
constexprnoexcept |
Creates a begin iterator.
|
constexprnoexcept |
Creates an end iterator.
|
constexprnoexcept |
Clears the string.
|
constexprnoexcept |
Creates a reverse begin iterator.
|
constexprnoexcept |
Creates a reverse end iterator.
|
constexprnoexcept |
Gets a pointer to the data.
|
constexprnoexcept |
Gets a pointer to the data.
|
constexprnoexcept |
Determines whether the string is empty.
|
constexprnoexcept |
Creates an end iterator.
|
constexprnoexcept |
Creates an end iterator.
|
constexprnoexcept |
Checks whether the string ends with a certain character.
|
constexpr |
Checks whether the string ends with a certain text.
|
constexprnoexcept |
Checks whether the string ends with a certain text.
|
constexprnoexcept |
Removes a range of characters from the string.
first | The position of the first character to remove. |
last | An iterator pointing one position past the last character to remove. |
|
constexprnoexcept |
Removes a single character from the string.
position | The position of the character to remove. position must point to an existing character within the string. |
|
constexpr |
Removes characters from the string.
index | The index of the first character to remove. Must be a valid index within the string, or size() to remove characters from the end of the string. Since there are no characters beyond the end of the string, no characters are ever removed if index is equal to size(). |
count | The maximum number of characters to remove, or npos to remove all remaining characters. count is allowed to extend beyond the end of the string, in which case all remaining characters are removed.. |
std::out_of_range | index is greater than size(). |
|
constexprnoexcept |
Returns the first character.
|
constexprnoexcept |
Returns the first character.
|
constexpr |
Inserts a single character into the string.
where | The desired position of the character. Must be a position within the string, or cend() to append the character. |
character | The character to insert. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Inserts a character sequence into the string.
where | The desired position of the character sequence. Must be a position within the string, or cend() to append the sequence. |
first | An iterator pointing to the first character to insert. |
last | An iterator pointing one position past the last character to insert. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Inserts a number of copies of a character into the string.
where | The desired position of the characters. Must be a position within the string, or cend() to append the characters. |
count | The number of repetitions of the character. |
character | The character to insert. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Inserts the characters from an initializer list into the string.
where | The desired position of the characters. Must be a position within the string, or cend() to append the characters. |
characters | The characters to initialize the string with. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Inserts another static string of the same capacity into the string.
where | The desired index of the string. Must be a valid index within the string, or size() to append the string. |
string | The string to insert. |
std::out_of_range | where is greater than size(). |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Inserts a sub string of another static string of the same capacity into the string.
where | The desired index of the sub string. Must be a valid index within the string, or size() to append the sub string. |
string | The string to insert from. |
position | The position of the sub string to insert. Must be a valid sub string position within string, meaning it must be between 0 and the string.size(), inclusively. |
count | The maximum length of the sub string to insert, or npos to always copy the remainder of the string. |
std::out_of_range | where is greater than size(). |
std::out_of_range | position is greater than the size of string. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Inserts a null-terminated string into the string.
where | The desired index of the string. Must be a valid index within the string, or size() to append the string. |
string | The string to insert. The string must be null-terminated. |
std::out_of_range | where is greater than size(). |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Inserts characters from an array into the string.
where | The desired index of the characters. Must be a valid index within the string, or size() to append the characters. |
string | A pointer to the characters to insert. The pointer must point to a memory region that is at least count characters long. |
count | The number of characters to insert. |
std::out_of_range | where is greater than size(). |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Inserts an arbitrary string into the string.
where | The desired index of the string. Must be a valid index within the string, or size() to append the string. |
String | The string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>. |
string | The string to insert. |
std::out_of_range | where is greater than size(). |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Inserts a sub string of a string, up to a maximum length into the string.
String | The string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>. |
where | The desired index of the sub string. Must be a valid index within the string, or size() to append the sub string. |
string | The string to insert from. |
position | The position of the sub string to insert. Must be a valid sub string position within string, meaning it must be between 0 and the size of the string contained in string, inclusively. |
count | The maximum length of the sub string to insert, or npos to always copy the remainder of the string. The length of the sub string is calculated in the same way as std::basic_string_view::substr(). |
std::out_of_range | where is greater than size(). |
std::out_of_range | position is greater than the size of the string contained in string. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Inserts a number of copies of a character into the string.
where | The desired index of the characters. Must be a valid index within the string, or size() to append the characters. |
count | The number of repetitions of the character. |
character | The character to insert. |
std::out_of_range | where is greater than size(). |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexprnoexcept |
Alias for size()
|
staticconstexprnoexcept |
Gets the maximum size.
|
constexprnoexcept |
conversion to an std::string
|
constexprnoexcept |
conversion to a string view
|
constexpr |
Appends a single character to the string.
character | The character to append. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Appends another static string of the same capacity to the string.
string | The string to append. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Appends a null-terminated string to the string.
string | The string to append. The string must be null-terminated. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Appends an arbitrary string to the string.
String | The string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>. |
string | The string to append. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Appends the characters from an initializer list to the string.
characters | The characters to initialize the string with. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexpr |
Assignment operator for a single character.
This constructor creates a string of size 1, containing the specified character
character | The character to assign. |
std::length_error | The length of the string is greater than kCapacity. |
|
constexprdefaultnoexcept |
Copy assignment operator.
|
constexpr |
Assignment operator for a null-terminated string.
string | The string to copy. The string must be null-terminated, and must be no more than kCapacity character long. |
std::length_error | kCapacity is less than 1. |
|
constexpr |
Assignment operator for an arbitrary string.
String | The string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>. |
string | The string to copy. The size of the string must not exceed kCapacity. |
std::length_error | The size of the string is greater than kCapacity. |
|
constexpr |
Assignment operator for an initializer list.
characters | The characters to initialize the string with. The size of the initializer list must not exceed kCapacity. |
std::length_error | The size of the initializer list is greater than kCapacity. |
|
constexprnoexcept |
Subscript operator.
Returns a reference to the character at a certain index
index | The index |
|
constexprnoexcept |
Subscript operator.
Returns a reference to the character at a certain index
index | The index |
|
constexprnoexcept |
Removes the last character of the string.
|
constexpr |
Appends a single character to the string.
character | The character to append. |
std::length_error | The resulting string size is greater than kCapacity. |
|
constexprnoexcept |
Returns an object that allows you to access to the string’s data and size directly.
The returned object gives you access to the raw buffer used by the string. You can use this object to manipulate and resize the string efficiently, without the overhead of using resize().
The buffer actually extends one position past kCapacity, to make room for a terminating null character. It is thus safe to read and write one position past the end of the buffer. This allows you to safely copy a string to the buffer including the terminating null, even if the string has a length of kCapacity and the terminating null will thus end up one position after the end of the buffer.
|
constexprnoexcept |
Creates a reverse begin iterator.
|
constexprnoexcept |
Creates a reverse begin iterator.
|
constexprnoexcept |
Creates a reverse end iterator.
|
constexprnoexcept |
Creates a reverse end iterator.
|
constexprnoexcept |
Resizes the string.
If the new size is smaller than the current size, then the string is truncated. If the new size is greater than the current size, then the string is padded with zeros.
newSize | The new size. Must not exceed kCapacity. |
std::length_error | The new size is larger than kCapacity. |
|
constexprnoexcept |
Resizes the string.
If the new size is smaller than the current size, then the string is truncated. If the new size is greater than the current size, then the string is padded with padding.
newSize | The new size. Must not exceed kCapacity. |
padding | The padding to use if the string size increases |
std::length_error | The new size is larger than kCapacity. |
|
constexprnoexcept |
Gets the current size.
|
constexprnoexcept |
Checks whether the string starts with a certain character.
|
constexpr |
Checks whether the string starts with a certain text.
|
constexprnoexcept |
Checks whether the string starts with a certain text.
|
constexprnoexcept |
Gets the data as an std::string.
|
constexprnoexcept |
Gets the data as a string view.
|
staticconstexpr |
Special size value used for automatically determined lengths.