Skip to content

Commit ba777c7

Browse files
author
dgolear
committed
YTORM-1187: Fix IN and BETWEEN expression work with indexes
commit_hash:12d86de033f73ea238ebde7f47b689d30014119a
1 parent 2d4605d commit ba777c7

File tree

2 files changed

+29
-31
lines changed

2 files changed

+29
-31
lines changed

library/cpp/yt/string/string-inl.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "string.h"
55
#endif
66

7-
#include "format.h"
7+
#include "string_builder.h"
88

99
namespace NYT {
1010

@@ -19,7 +19,7 @@ namespace NYT {
1919
* \param delimiter A delimiter to be inserted between items: ", " by default.
2020
* \return The resulting combined string.
2121
*/
22-
template <class TIterator, class TFormatter>
22+
template <std::forward_iterator TIterator, class TFormatter>
2323
void JoinToString(
2424
TStringBuilderBase* builder,
2525
const TIterator& begin,
@@ -35,7 +35,7 @@ void JoinToString(
3535
}
3636
}
3737

38-
template <class TIterator, class TFormatter>
38+
template <std::forward_iterator TIterator, class TFormatter>
3939
TString JoinToString(
4040
const TIterator& begin,
4141
const TIterator& end,
@@ -48,7 +48,7 @@ TString JoinToString(
4848
}
4949

5050
//! A handy shortcut with default formatter.
51-
template <class TIterator>
51+
template <std::forward_iterator TIterator>
5252
TString JoinToString(
5353
const TIterator& begin,
5454
const TIterator& end,
@@ -63,9 +63,9 @@ TString JoinToString(
6363
* \param formatter Formatter to apply to the items.
6464
* \param delimiter A delimiter to be inserted between items; ", " by default.
6565
*/
66-
template <class TCollection, class TFormatter>
66+
template <std::ranges::range TCollection, class TFormatter>
6767
TString JoinToString(
68-
const TCollection& collection,
68+
TCollection&& collection,
6969
const TFormatter& formatter,
7070
TStringBuf delimiter)
7171
{
@@ -75,12 +75,12 @@ TString JoinToString(
7575
}
7676

7777
//! A handy shortcut with the default formatter.
78-
template <class TCollection>
78+
template <std::ranges::range TCollection>
7979
TString JoinToString(
80-
const TCollection& collection,
80+
TCollection&& collection,
8181
TStringBuf delimiter)
8282
{
83-
return JoinToString(collection, TDefaultFormatter(), delimiter);
83+
return JoinToString(std::forward<TCollection>(collection), TDefaultFormatter(), delimiter);
8484
}
8585

8686
//! Concatenates a bunch of TStringBuf-like instances into TString.
@@ -98,7 +98,7 @@ TString ConcatToString(Ts... args)
9898
}
9999

100100
//! Converts a range of items into strings.
101-
template <class TIter, class TFormatter>
101+
template <std::forward_iterator TIter, class TFormatter>
102102
std::vector<TString> ConvertToStrings(
103103
const TIter& begin,
104104
const TIter& end,
@@ -118,7 +118,7 @@ std::vector<TString> ConvertToStrings(
118118
}
119119

120120
//! A handy shortcut with the default formatter.
121-
template <class TIter>
121+
template <std::forward_iterator TIter>
122122
std::vector<TString> ConvertToStrings(
123123
const TIter& begin,
124124
const TIter& end,
@@ -133,9 +133,9 @@ std::vector<TString> ConvertToStrings(
133133
* \param formatter Formatter to apply to the items.
134134
* \param maxSize Size limit for the resulting vector.
135135
*/
136-
template <class TCollection, class TFormatter>
136+
template <std::ranges::range TCollection, class TFormatter>
137137
std::vector<TString> ConvertToStrings(
138-
const TCollection& collection,
138+
TCollection&& collection,
139139
const TFormatter& formatter,
140140
size_t maxSize)
141141
{
@@ -145,12 +145,12 @@ std::vector<TString> ConvertToStrings(
145145
}
146146

147147
//! A handy shortcut with default formatter.
148-
template <class TCollection>
148+
template <std::ranges::range TCollection>
149149
std::vector<TString> ConvertToStrings(
150-
const TCollection& collection,
150+
TCollection&& collection,
151151
size_t maxSize)
152152
{
153-
return ConvertToStrings(collection, TDefaultFormatter(), maxSize);
153+
return ConvertToStrings(std::forward<TCollection>(collection), TDefaultFormatter(), maxSize);
154154
}
155155

156156
////////////////////////////////////////////////////////////////////////////////

library/cpp/yt/string/string.h

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#include <util/string/strip.h>
1010

1111
#include <vector>
12-
#include <set>
13-
#include <map>
1412

1513
namespace NYT {
1614

@@ -65,23 +63,23 @@ static constexpr TStringBuf IntToHexUppercase = "0123456789ABCDEF";
6563
* \param delimiter A delimiter to be inserted between items: ", " by default.
6664
* \return The resulting combined string.
6765
*/
68-
template <class TIterator, class TFormatter>
66+
template <std::forward_iterator TIterator, class TFormatter>
6967
void JoinToString(
7068
TStringBuilderBase* builder,
7169
const TIterator& begin,
7270
const TIterator& end,
7371
const TFormatter& formatter,
7472
TStringBuf delimiter = DefaultJoinToStringDelimiter);
7573

76-
template <class TIterator, class TFormatter>
74+
template <std::forward_iterator TIterator, class TFormatter>
7775
TString JoinToString(
7876
const TIterator& begin,
7977
const TIterator& end,
8078
const TFormatter& formatter,
8179
TStringBuf delimiter = DefaultJoinToStringDelimiter);
8280

8381
//! A handy shortcut with default formatter.
84-
template <class TIterator>
82+
template <std::forward_iterator TIterator>
8583
TString JoinToString(
8684
const TIterator& begin,
8785
const TIterator& end,
@@ -93,32 +91,32 @@ TString JoinToString(
9391
* \param formatter Formatter to apply to the items.
9492
* \param delimiter A delimiter to be inserted between items; ", " by default.
9593
*/
96-
template <class TCollection, class TFormatter>
94+
template <std::ranges::range TCollection, class TFormatter>
9795
TString JoinToString(
98-
const TCollection& collection,
96+
TCollection&& collection,
9997
const TFormatter& formatter,
10098
TStringBuf delimiter = DefaultJoinToStringDelimiter);
10199

102100
//! A handy shortcut with the default formatter.
103-
template <class TCollection>
101+
template <std::ranges::range TCollection>
104102
TString JoinToString(
105-
const TCollection& collection,
103+
TCollection&& collection,
106104
TStringBuf delimiter = DefaultJoinToStringDelimiter);
107105

108106
//! Concatenates a bunch of TStringBuf-like instances into TString.
109107
template <class... Ts>
110108
TString ConcatToString(Ts... args);
111109

112110
//! Converts a range of items into strings.
113-
template <class TIter, class TFormatter>
111+
template <std::forward_iterator TIter, class TFormatter>
114112
std::vector<TString> ConvertToStrings(
115113
const TIter& begin,
116114
const TIter& end,
117115
const TFormatter& formatter,
118116
size_t maxSize = std::numeric_limits<size_t>::max());
119117

120118
//! A handy shortcut with the default formatter.
121-
template <class TIter>
119+
template <std::forward_iterator TIter>
122120
std::vector<TString> ConvertToStrings(
123121
const TIter& begin,
124122
const TIter& end,
@@ -130,16 +128,16 @@ std::vector<TString> ConvertToStrings(
130128
* \param formatter Formatter to apply to the items.
131129
* \param maxSize Size limit for the resulting vector.
132130
*/
133-
template <class TCollection, class TFormatter>
131+
template <std::ranges::range TCollection, class TFormatter>
134132
std::vector<TString> ConvertToStrings(
135-
const TCollection& collection,
133+
TCollection&& collection,
136134
const TFormatter& formatter,
137135
size_t maxSize = std::numeric_limits<size_t>::max());
138136

139137
//! A handy shortcut with default formatter.
140-
template <class TCollection>
138+
template <std::ranges::range TCollection>
141139
std::vector<TString> ConvertToStrings(
142-
const TCollection& collection,
140+
TCollection&& collection,
143141
size_t maxSize = std::numeric_limits<size_t>::max());
144142

145143
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)