diff options
author | swarmer <[email protected]> | 2022-05-24 01:42:42 +0300 |
---|---|---|
committer | swarmer <[email protected]> | 2022-05-24 01:42:42 +0300 |
commit | 9e6590dab63a1a07e738a246030af9b888333214 (patch) | |
tree | 038ab3bdf14231ab80bcfa12922f2371ea0c0a31 /util/string/strip.h | |
parent | cc9b48149be0bca6e6c350983ace4fc660902b80 (diff) |
[util] StripInPlace should modify string in-place
ref:2aec19528c2378a0994534ec032550413a095389
Diffstat (limited to 'util/string/strip.h')
-rw-r--r-- | util/string/strip.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/util/string/strip.h b/util/string/strip.h index c2ea61adce0..8d9e5ed988d 100644 --- a/util/string/strip.h +++ b/util/string/strip.h @@ -4,6 +4,7 @@ #include <util/generic/string.h> #include <util/generic/strbuf.h> +#include <util/generic/typetraits.h> #include <utility> template <class It> @@ -86,7 +87,11 @@ struct TStripImpl { auto e = from.end(); if (StripRange(b, e, criterion)) { - to = T(b, e - b); + if constexpr (::TIsTemplateBaseOf<std::basic_string_view, T>::value) { + to = T(b, e - b); + } else { + to.assign(b, e - b); + } return true; } |