[PATCH] include/string: Bail out early on erase
Rosen Penev <[email protected]> Sat, 26 Oct 2019 22:43:45 -0700
| Newsgroups | gmane.comp.lib.uclibc.general |
|---|---|
| Message-ID | <[email protected]> |
When string is empty. Signed-off-by: Rosen Penev <[email protected]> --- include/string | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/string b/include/string index 020c469..abdcc0c 100644 --- a/include/string +++ b/include/string @@ -323,6 +323,9 @@ public: iterator temp = last; + if (!count) + return first; + while(last != vector<Ch, A>::end()){ *(last - count) = *last; ++last; -- 2.23.0