Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
basic_static_string::replace (8 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);
Description

Replaces rcount characters starting at index pos with those of [s, s + len), where the length of the string len is traits_type::length(s) and 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.

Exceptions

Type

Thrown On

std::length_error

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

std::out_of_range

pos > size()


PrevUpHomeNext