diff options
author | eeight <eeight@yandex-team.ru> | 2022-02-10 16:46:18 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:18 +0300 |
commit | 475c0a46f28166e83fd263badc7546377cddcabe (patch) | |
tree | 39c5a49b8aaad78fe390b6f1f2886bdbda40f3e7 /util/string/reverse.cpp | |
parent | a6e0145a095c7bb3770d6e07aee301de5c73f96e (diff) | |
download | ydb-475c0a46f28166e83fd263badc7546377cddcabe.tar.gz |
Restoring authorship annotation for <eeight@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/string/reverse.cpp')
-rw-r--r-- | util/string/reverse.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/util/string/reverse.cpp b/util/string/reverse.cpp index 167cd11f49..3d67e95b04 100644 --- a/util/string/reverse.cpp +++ b/util/string/reverse.cpp @@ -1,33 +1,33 @@ -#include "reverse.h" - -#include <util/generic/string.h> -#include <util/generic/vector.h> -#include <util/charset/wide_specific.h> - -#include <algorithm> - -void ReverseInPlace(TString& string) { - auto* begin = string.begin(); - std::reverse(begin, begin + string.size()); -} - -void ReverseInPlace(TUtf16String& string) { - auto* begin = string.begin(); - const auto len = string.size(); - auto* end = begin + string.size(); - - TVector<wchar16> buffer(len); - wchar16* rbegin = buffer.data() + len; - for (wchar16* p = begin; p < end;) { - const size_t symbolSize = W16SymbolSize(p, end); - rbegin -= symbolSize; - std::copy(p, p + symbolSize, rbegin); - p += symbolSize; - } - std::copy(buffer.begin(), buffer.end(), begin); -} - -void ReverseInPlace(TUtf32String& string) { - auto* begin = string.begin(); - std::reverse(begin, begin + string.size()); -} +#include "reverse.h" + +#include <util/generic/string.h> +#include <util/generic/vector.h> +#include <util/charset/wide_specific.h> + +#include <algorithm> + +void ReverseInPlace(TString& string) { + auto* begin = string.begin(); + std::reverse(begin, begin + string.size()); +} + +void ReverseInPlace(TUtf16String& string) { + auto* begin = string.begin(); + const auto len = string.size(); + auto* end = begin + string.size(); + + TVector<wchar16> buffer(len); + wchar16* rbegin = buffer.data() + len; + for (wchar16* p = begin; p < end;) { + const size_t symbolSize = W16SymbolSize(p, end); + rbegin -= symbolSize; + std::copy(p, p + symbolSize, rbegin); + p += symbolSize; + } + std::copy(buffer.begin(), buffer.end(), begin); +} + +void ReverseInPlace(TUtf32String& string) { + auto* begin = string.begin(); + std::reverse(begin, begin + string.size()); +} |