diff options
author | dgolear <dgolear@yandex-team.com> | 2024-10-17 18:38:56 +0300 |
---|---|---|
committer | dgolear <dgolear@yandex-team.com> | 2024-10-17 18:50:05 +0300 |
commit | ba777c7e02eaa66c9eaec1c16085e641360c1690 (patch) | |
tree | 2e4ad181d549e5f9924ce7c9055936ab09dca16f | |
parent | 2d4605d627b27be5dcb71d0e649959a5fa020524 (diff) | |
download | ydb-ba777c7e02eaa66c9eaec1c16085e641360c1690.tar.gz |
YTORM-1187: Fix IN and BETWEEN expression work with indexes
commit_hash:12d86de033f73ea238ebde7f47b689d30014119a
-rw-r--r-- | library/cpp/yt/string/string-inl.h | 32 | ||||
-rw-r--r-- | library/cpp/yt/string/string.h | 28 |
2 files changed, 29 insertions, 31 deletions
diff --git a/library/cpp/yt/string/string-inl.h b/library/cpp/yt/string/string-inl.h index baf789b4f1..e3bf094aa3 100644 --- a/library/cpp/yt/string/string-inl.h +++ b/library/cpp/yt/string/string-inl.h @@ -4,7 +4,7 @@ #include "string.h" #endif -#include "format.h" +#include "string_builder.h" namespace NYT { @@ -19,7 +19,7 @@ namespace NYT { * \param delimiter A delimiter to be inserted between items: ", " by default. * \return The resulting combined string. */ -template <class TIterator, class TFormatter> +template <std::forward_iterator TIterator, class TFormatter> void JoinToString( TStringBuilderBase* builder, const TIterator& begin, @@ -35,7 +35,7 @@ void JoinToString( } } -template <class TIterator, class TFormatter> +template <std::forward_iterator TIterator, class TFormatter> TString JoinToString( const TIterator& begin, const TIterator& end, @@ -48,7 +48,7 @@ TString JoinToString( } //! A handy shortcut with default formatter. -template <class TIterator> +template <std::forward_iterator TIterator> TString JoinToString( const TIterator& begin, const TIterator& end, @@ -63,9 +63,9 @@ TString JoinToString( * \param formatter Formatter to apply to the items. * \param delimiter A delimiter to be inserted between items; ", " by default. */ -template <class TCollection, class TFormatter> +template <std::ranges::range TCollection, class TFormatter> TString JoinToString( - const TCollection& collection, + TCollection&& collection, const TFormatter& formatter, TStringBuf delimiter) { @@ -75,12 +75,12 @@ TString JoinToString( } //! A handy shortcut with the default formatter. -template <class TCollection> +template <std::ranges::range TCollection> TString JoinToString( - const TCollection& collection, + TCollection&& collection, TStringBuf delimiter) { - return JoinToString(collection, TDefaultFormatter(), delimiter); + return JoinToString(std::forward<TCollection>(collection), TDefaultFormatter(), delimiter); } //! Concatenates a bunch of TStringBuf-like instances into TString. @@ -98,7 +98,7 @@ TString ConcatToString(Ts... args) } //! Converts a range of items into strings. -template <class TIter, class TFormatter> +template <std::forward_iterator TIter, class TFormatter> std::vector<TString> ConvertToStrings( const TIter& begin, const TIter& end, @@ -118,7 +118,7 @@ std::vector<TString> ConvertToStrings( } //! A handy shortcut with the default formatter. -template <class TIter> +template <std::forward_iterator TIter> std::vector<TString> ConvertToStrings( const TIter& begin, const TIter& end, @@ -133,9 +133,9 @@ std::vector<TString> ConvertToStrings( * \param formatter Formatter to apply to the items. * \param maxSize Size limit for the resulting vector. */ -template <class TCollection, class TFormatter> +template <std::ranges::range TCollection, class TFormatter> std::vector<TString> ConvertToStrings( - const TCollection& collection, + TCollection&& collection, const TFormatter& formatter, size_t maxSize) { @@ -145,12 +145,12 @@ std::vector<TString> ConvertToStrings( } //! A handy shortcut with default formatter. -template <class TCollection> +template <std::ranges::range TCollection> std::vector<TString> ConvertToStrings( - const TCollection& collection, + TCollection&& collection, size_t maxSize) { - return ConvertToStrings(collection, TDefaultFormatter(), maxSize); + return ConvertToStrings(std::forward<TCollection>(collection), TDefaultFormatter(), maxSize); } //////////////////////////////////////////////////////////////////////////////// diff --git a/library/cpp/yt/string/string.h b/library/cpp/yt/string/string.h index b91d1b3805..9794cfd69f 100644 --- a/library/cpp/yt/string/string.h +++ b/library/cpp/yt/string/string.h @@ -9,8 +9,6 @@ #include <util/string/strip.h> #include <vector> -#include <set> -#include <map> namespace NYT { @@ -65,7 +63,7 @@ static constexpr TStringBuf IntToHexUppercase = "0123456789ABCDEF"; * \param delimiter A delimiter to be inserted between items: ", " by default. * \return The resulting combined string. */ -template <class TIterator, class TFormatter> +template <std::forward_iterator TIterator, class TFormatter> void JoinToString( TStringBuilderBase* builder, const TIterator& begin, @@ -73,7 +71,7 @@ void JoinToString( const TFormatter& formatter, TStringBuf delimiter = DefaultJoinToStringDelimiter); -template <class TIterator, class TFormatter> +template <std::forward_iterator TIterator, class TFormatter> TString JoinToString( const TIterator& begin, const TIterator& end, @@ -81,7 +79,7 @@ TString JoinToString( TStringBuf delimiter = DefaultJoinToStringDelimiter); //! A handy shortcut with default formatter. -template <class TIterator> +template <std::forward_iterator TIterator> TString JoinToString( const TIterator& begin, const TIterator& end, @@ -93,16 +91,16 @@ TString JoinToString( * \param formatter Formatter to apply to the items. * \param delimiter A delimiter to be inserted between items; ", " by default. */ -template <class TCollection, class TFormatter> +template <std::ranges::range TCollection, class TFormatter> TString JoinToString( - const TCollection& collection, + TCollection&& collection, const TFormatter& formatter, TStringBuf delimiter = DefaultJoinToStringDelimiter); //! A handy shortcut with the default formatter. -template <class TCollection> +template <std::ranges::range TCollection> TString JoinToString( - const TCollection& collection, + TCollection&& collection, TStringBuf delimiter = DefaultJoinToStringDelimiter); //! Concatenates a bunch of TStringBuf-like instances into TString. @@ -110,7 +108,7 @@ template <class... Ts> TString ConcatToString(Ts... args); //! Converts a range of items into strings. -template <class TIter, class TFormatter> +template <std::forward_iterator TIter, class TFormatter> std::vector<TString> ConvertToStrings( const TIter& begin, const TIter& end, @@ -118,7 +116,7 @@ std::vector<TString> ConvertToStrings( size_t maxSize = std::numeric_limits<size_t>::max()); //! A handy shortcut with the default formatter. -template <class TIter> +template <std::forward_iterator TIter> std::vector<TString> ConvertToStrings( const TIter& begin, const TIter& end, @@ -130,16 +128,16 @@ std::vector<TString> ConvertToStrings( * \param formatter Formatter to apply to the items. * \param maxSize Size limit for the resulting vector. */ -template <class TCollection, class TFormatter> +template <std::ranges::range TCollection, class TFormatter> std::vector<TString> ConvertToStrings( - const TCollection& collection, + TCollection&& collection, const TFormatter& formatter, size_t maxSize = std::numeric_limits<size_t>::max()); //! A handy shortcut with default formatter. -template <class TCollection> +template <std::ranges::range TCollection> std::vector<TString> ConvertToStrings( - const TCollection& collection, + TCollection&& collection, size_t maxSize = std::numeric_limits<size_t>::max()); //////////////////////////////////////////////////////////////////////////////// |