diff options
| author | eeight <[email protected]> | 2022-02-10 16:46:19 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:19 +0300 |
| commit | bd085aee9b4f7a0bee302ce687964ffb7098f986 (patch) | |
| tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/string/reverse.cpp | |
| parent | 475c0a46f28166e83fd263badc7546377cddcabe (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 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 3d67e95b047..167cd11f49b 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()); +} |
