Bug 2657248: flex_string replace error when replacing from an empty range
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@992 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
0e615e0932
commit
fc81b2a539
1 changed files with 7 additions and 1 deletions
|
@ -804,9 +804,15 @@ private:
|
||||||
const typename std::iterator_traits<iterator>::difference_type n1 =
|
const typename std::iterator_traits<iterator>::difference_type n1 =
|
||||||
i2 - i1;
|
i2 - i1;
|
||||||
assert(n1 >= 0);
|
assert(n1 >= 0);
|
||||||
|
|
||||||
const typename std::iterator_traits<FwdIterator>::difference_type n2 =
|
const typename std::iterator_traits<FwdIterator>::difference_type n2 =
|
||||||
std::distance(s1, s2);
|
std::distance(s1, s2);
|
||||||
assert(n2 >= 0);
|
|
||||||
|
// Empty replacement.
|
||||||
|
if(0 == n2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
assert(n2 > 0);
|
||||||
|
|
||||||
// Handle aliased replace
|
// Handle aliased replace
|
||||||
static const std::less_equal<const value_type*> le =
|
static const std::less_equal<const value_type*> le =
|
||||||
|
|
Loading…
Reference in a new issue