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 a snapshot of the master branch, built from commit 84c43c2541.
PrevUpHomeNext
string::replace (1 of 5 overloads)

Replace a substring with a string.

Synopsis
string&
replace(
    std::size_t pos,
    std::size_t count,
    string_view sv);
Description

Replaces rcount characters starting at index pos with those of sv, where rcount is std::min(count, size() - pos).

Exception Safety

Strong guarantee.

Remarks

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

Return Value

*this

Parameters

Name

Description

pos

The index to replace at.

count

The number of characters to replace.

sv

The string_view to replace with.

Exceptions

Type

Thrown On

boost::system::system_error

size() + (sv.size() - rcount) > max_size().

boost::system::system_error

pos > size().


PrevUpHomeNext