Added most replace impls and fixed whitespace

This commit is contained in:
Krystian Stasiowski
2019-10-18 19:02:10 -04:00
committed by GitHub
parent 295fa23c49
commit e2119bd662

View File

@ -1286,7 +1286,10 @@ public:
replace(
size_type pos1,
size_type n1,
const fixed_string& str);
const fixed_string& str)
{
return replace(pos1, n1, str.data(), str.size());
}
fixed_string&
replace(
@ -1294,14 +1297,21 @@ public:
size_type n1,
const fixed_string& str,
size_type pos2,
size_type n2 = npos);
size_type n2 = npos)
{
return replace(pos1, n1, string_view_type(str).substr(pos2, n2));
}
template<typename T>
fixed_string&
replace(
size_type pos1,
size_type n1,
const T& t);
const T& t)
{
string_view_type sv = t;
return replace(pos1, n1, sv.data(), sv.size());
}
template<typename T>
fixed_string&
@ -1310,8 +1320,13 @@ public:
size_type n1,
const T& t,
size_type pos2,
size_type n2 = npos);
size_type n2 = npos)
{
string_view_type sv = t;
return replace(pos1, n1, sv.substr(pos2, n2));
}
// impl
fixed_string&
replace(
size_type pos,
@ -1323,8 +1338,12 @@ public:
replace(
size_type pos,
size_type n1,
const CharT* s);
const CharT* s)
{
return replace(pos, n, s, Traits::length(s));
}
// impl
fixed_string&
replace(
size_type pos,
@ -1336,34 +1355,50 @@ public:
replace(
const_iterator i1,
const_iterator i2,
const fixed_string& str);
const fixed_string& str)
{
return replace(i1, i2, string_view_type(str));
}
template<typename T>
fixed_string&
replace(
const_iterator i1,
const_iterator i2,
const T& t);
const T& t)
{
string_view_type sv = t;
return replace(i1 - begin(), i2 - i1, sv.data(), sv.size());
}
fixed_string&
replace(
const_iterator i1,
const_iterator i2,
const CharT* s,
size_type n);
size_type n)
{
return replace(i1, i2, string_view_type(s, n));
}
fixed_string&
replace(
const_iterator i1,
const_iterator i2,
const CharT* s);
const CharT* s)
{
return replace(i1, i2, string_view_type(s));
}
fixed_string&
replace(
const_iterator i1,
const_iterator i2,
size_type n,
CharT c);
CharT c)
{
return replace(i1 - begin(), i2 - i1, n, c);
}
template<typename InputIterator>
fixed_string&
@ -1371,13 +1406,19 @@ public:
const_iterator i1,
const_iterator i2,
InputIterator j1,
InputIterator j2);
InputIterator j2)
{
return replace(i1, i2, fixed_string(j1, j2));
}
fixed_string&
replace(
const_iterator,
const_iterator,
std::initializer_list<CharT>);
std::initializer_list<CharT>)
{
return replace(i1, i2, il.begin(), il.size());
}
//--------------------------------------------------------------------------
//