mp_units::basic_fixed_string

A compile-time fixed string

Synopsis

Declared in <mp-units/ext/fixed_string.h>

template<
    typename CharT,
    std::size_t N>
class basic_fixed_string
    : public /* implementation-defined */

Base Classes

NameDescription
/* implementation-defined */

Type Aliases

NameDescription
const_iterator Constant iterator over the string's elements
const_pointer Pointer to a constant character of the string
const_reference Reference to a constant character of the string
const_reverse_iterator Reverse iterator over the string's constant elements
difference_type Signed integer type used to represent iterator differences
iterator Iterator type (same as const_iterator, as the string is immutable)
pointer Pointer to a character of the string
reference Reference to a character of the string
reverse_iterator Reverse iterator type (same as const_reverse_iterator, as the string is immutable)
size_type Unsigned integer type used to represent sizes and indices
value_type The character type used by the string

Member Functions

NameDescription
basic_fixed_string [constructor]Constructors
operator= Copy assignment operator
at Accesses the character at the given position, with bounds checking
back The last character of the string.
begin An iterator to the first character of the string.
c_str A pointer to a null-terminated character array holding the string's contents.
cbegin A constant iterator to the first character of the string.
cend A constant iterator past the last character of the string.
crbegin A constant reverse iterator to the last character of the string.
crend A constant reverse iterator preceding the first character of the string.
data A pointer to the underlying null-terminated character array.
end An iterator past the last character of the string.
front The first character of the string.
operator[] Accesses the character at the given position, without bounds checking
rbegin A reverse iterator to the last character of the string.
rend A reverse iterator preceding the first character of the string.
swap Exchanges the contents of this string with those of s
view A std::basic_string_view over the string's contents.
operator std::basic_string_view<CharT> Implicit conversion to a std::basic_string_view over the string's contents.

Data Members

NameDescription
data_ The underlying null-terminated character storage (exposition only)

Static Data Members

NameDescription
empty Whether the string holds no characters
length The number of characters in the string (same as size)
max_size The maximum number of characters the string can hold (same as size, since the length is fixed)
size The number of characters in the string

Deduction Guides

NameDescription
basic_fixed_string<CharT, 1 + sizeof...(Rest)> Deduces basic_fixed_string from a pack of individual characters
basic_fixed_string<CharT, N> Deduces basic_fixed_string from a std::array of characters
basic_fixed_string<CharT, N - 1> Deduces basic_fixed_string from a null-terminated character array literal

Template Parameters

NameDescription
CharTCharacter type to be used by the string
NThe size of the string