Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
basic_static_string::replace (7 of 19 overloads)

Replace a substring with a string.

Synopsis
BOOST_STATIC_STRING_CPP14_CONSTEXPR basic_static_string&
replace(
    size_type pos,
    size_type n1,
    const_pointer s,
    size_type n2);
Description

Replaces rcount characters starting at index pos with those of [s, s + n2), where rcount is std::min(n1, 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.

n1

The number of characters to replace.

s

The string to replace with.

n2

The length of the string to replace with.

Exceptions

Type

Thrown On

std::length_error

size() + (n2 - rcount) > max_size()

std::out_of_range

pos > size()


PrevUpHomeNext