Beast Logo

PrevUpHomeNext

static_string

A string with a fixed-size storage area.

template<
    std::size_t N,
    class CharT = char,
    class Traits = std::char_traits<CharT>>
class static_string
Types

Name

Description

const_iterator

const_pointer

const_reference

const_reverse_iterator

difference_type

iterator

pointer

reference

reverse_iterator

size_type

traits_type

value_type

Member Functions

Name

Description

at

Access specified character with bounds checking.

back

Accesses the last character.

begin

Returns an iterator to the beginning.

c_str

Returns a non-modifiable standard C character array version of the string.

capacity

Returns the number of characters that can be held in currently allocated storage.

cbegin

Returns an iterator to the beginning.

cend

Returns an iterator to the end.

clear

Clears the contents.

compare

Compare two character sequences.

crbegin

Returns a reverse iterator to the beginning.

crend

Returns a reverse iterator to the end.

data

Returns a pointer to the first character of a string.

empty

Returns true if the string is empty.

end

Returns an iterator to the end.

front

Accesses the first character.

max_size

Returns the maximum number of characters that can be stored, excluding the null terminator.

operator=

Copy assignment.

Assign from string literal.

operator[]

Access specified character.

rbegin

Returns a reverse iterator to the beginning.

rend

Returns a reverse iterator to the end.

resize

Changes the number of characters stored.

size

Returns the number of characters, excluding the null terminator.

static_string

Default constructor.

Copy constructor.

Construct from string literal.

to_string

Return the characters as a basic_string.

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.

Remarks

The stored string is always null-terminated.

Requirements

Header: beast/core/static_string.hpp

Convenience header: beast/core.hpp


PrevUpHomeNext