Fix unchecked replacement.

This commit is contained in:
Krystian Stasiowski
2020-01-01 15:38:41 -05:00
parent 3a4f2e9d83
commit f800ef49e4

View File

@ -1611,7 +1611,7 @@ public:
/** Replace a subset of the string.
Replaces the part of the string indicated by `[pos1, pos1 + n1)` with `s`
Replaces the part of the string indicated by `[pos1, pos1 + n1)` with `s`. This replacement is done unchecked.
@throw std::out_of_range if `pos1 > size()`
@throw std::length_error if the resulting string exceeds `max_size()`
@ -1628,6 +1628,24 @@ public:
return replace_unchecked(pos1, n1, str.data(), str.size());
}
/** Replace a subset of the string.
Replaces the part of the string indicated by `[pos1, pos1 + n1)` with `s`.
@throw std::out_of_range if `pos1 > size()`
@throw std::length_error if the resulting string exceeds `max_size()`
@return `*this`
*/
BOOST_STATIC_STRING_CPP14_CONSTEXPR
basic_static_string&
replace(
size_type pos1,
size_type n1,
const basic_static_string& str) BOOST_STATIC_STRING_COND_NOEXCEPT
{
return replace(pos1, n1, str.data(), str.size());
}
/** Replace a subset of the string.
Replaces the part of the string indicated by `[pos1, pos1 + n1)` with substring `[pos2, pos2 + n2)` of `str`