From 4dbf62fd2f8cc5ece53cc1446561cf71476bdd12 Mon Sep 17 00:00:00 2001 From: babenko Date: Wed, 24 Dec 2025 23:29:35 +0300 Subject: Explicitly use TCowString in TYsonString MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Для ревьюеров: изменения вне `library/cpp/yt` убирают `using namespace NYT` из хедера. Эта конструкция приводила к клешу имен глобального неймспейса и `NYT` и ошибкам сборки. commit_hash:f598da488a6dd8671af9f1f02870ab5612ae46eb --- library/cpp/containers/cow_string/reverse.cpp | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 library/cpp/containers/cow_string/reverse.cpp (limited to 'library/cpp/containers/cow_string/reverse.cpp') diff --git a/library/cpp/containers/cow_string/reverse.cpp b/library/cpp/containers/cow_string/reverse.cpp new file mode 100644 index 00000000000..b5bd10d250a --- /dev/null +++ b/library/cpp/containers/cow_string/reverse.cpp @@ -0,0 +1,32 @@ +#include "reverse.h" + +#include +#include + +#include + +void ReverseInPlace(TCowString& string) { + auto* begin = string.begin(); + std::reverse(begin, begin + string.size()); +} + +void ReverseInPlace(TUtf16CowString& string) { + auto* begin = string.begin(); + const auto len = string.size(); + auto* end = begin + string.size(); + + TVector 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(TUtf32CowString& string) { + auto* begin = string.begin(); + std::reverse(begin, begin + string.size()); +} -- cgit v1.3