string::insert

Insert a string.

Synopsis

string&
insert(
    std::size_t pos,
    string_view sv); (1)

string&
insert(
    std::size_t pos,
    std::size_t count,
    char ch); (2)

string&
insert(
    string::size_type pos,
    char ch); (3)

template<
    class InputIt>
string&
insert(
    string::size_type pos,
    InputIt first,
    InputIt last); (4)

Description

Inserts the string_view sv at the position pos.

Exception Safety

Strong guarantee.

All references, pointers, or iterators referring to contained elements are invalidated. Any past-the-end iterators are also invalidated.

Template Parameters

Type Description

InputIt

The type of the iterators.

Return Value

*this

Return Value

*this

Return Value

*this

Return Value

*this

Parameters

Name Description

pos

The index to insert at.

sv

The string_view to insert.

count

The number of characters to insert.

ch

The character to insert.

first

The beginning of the character range.

last

The end of the character range.

Exceptions

Type Thrown On

boost::system::system_error

size() + s.size() > max_size().