Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
basic_static_string::insert (5 of 11 overloads)

Insert into the string.

Synopsis
template<
    std::size_t M>
constexpr basic_static_string&
insert(
    size_type index,
    const basic_static_string< M, CharT, Traits >& str,
    size_type index_str,
    size_type count = npos);
Description

Inserts a string, obtained by str.substr(index_str, count) at the position index.

Exception Safety

Strong guarantee.

Remarks

The insertion is done unchecked when the capacity of str differs from that of the string the function is called on.

Remarks

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

Template Parameters

Type

Description

M

The size of the input string.

Return Value

*this

Parameters

Name

Description

index

The index to insert at.

str

The string from which to insert.

index_str

The index in str to start inserting from.

count

The number of characters to insert. The default argument for this parameter is npos.

Exceptions

Type

Thrown On

std::length_error

size() + str.substr(index_str, count).size() > max_size()

std::out_of_range

index > size()

std::out_of_range

index_str > str.size()


PrevUpHomeNext