4
4
#include " string.h"
5
5
#endif
6
6
7
- #include " format .h"
7
+ #include " string_builder .h"
8
8
9
9
namespace NYT {
10
10
@@ -19,7 +19,7 @@ namespace NYT {
19
19
* \param delimiter A delimiter to be inserted between items: ", " by default.
20
20
* \return The resulting combined string.
21
21
*/
22
- template <class TIterator , class TFormatter >
22
+ template <std::forward_iterator TIterator, class TFormatter >
23
23
void JoinToString (
24
24
TStringBuilderBase* builder,
25
25
const TIterator& begin,
@@ -35,7 +35,7 @@ void JoinToString(
35
35
}
36
36
}
37
37
38
- template <class TIterator , class TFormatter >
38
+ template <std::forward_iterator TIterator, class TFormatter >
39
39
TString JoinToString (
40
40
const TIterator& begin,
41
41
const TIterator& end,
@@ -48,7 +48,7 @@ TString JoinToString(
48
48
}
49
49
50
50
// ! A handy shortcut with default formatter.
51
- template <class TIterator >
51
+ template <std::forward_iterator TIterator>
52
52
TString JoinToString (
53
53
const TIterator& begin,
54
54
const TIterator& end,
@@ -63,9 +63,9 @@ TString JoinToString(
63
63
* \param formatter Formatter to apply to the items.
64
64
* \param delimiter A delimiter to be inserted between items; ", " by default.
65
65
*/
66
- template <class TCollection , class TFormatter >
66
+ template <std::ranges::range TCollection, class TFormatter >
67
67
TString JoinToString (
68
- const TCollection& collection,
68
+ TCollection& & collection,
69
69
const TFormatter& formatter,
70
70
TStringBuf delimiter)
71
71
{
@@ -75,12 +75,12 @@ TString JoinToString(
75
75
}
76
76
77
77
// ! A handy shortcut with the default formatter.
78
- template <class TCollection >
78
+ template <std::ranges::range TCollection>
79
79
TString JoinToString (
80
- const TCollection& collection,
80
+ TCollection& & collection,
81
81
TStringBuf delimiter)
82
82
{
83
- return JoinToString (collection, TDefaultFormatter (), delimiter);
83
+ return JoinToString (std::forward<TCollection>( collection) , TDefaultFormatter (), delimiter);
84
84
}
85
85
86
86
// ! Concatenates a bunch of TStringBuf-like instances into TString.
@@ -98,7 +98,7 @@ TString ConcatToString(Ts... args)
98
98
}
99
99
100
100
// ! Converts a range of items into strings.
101
- template <class TIter , class TFormatter >
101
+ template <std::forward_iterator TIter, class TFormatter >
102
102
std::vector<TString> ConvertToStrings (
103
103
const TIter& begin,
104
104
const TIter& end,
@@ -118,7 +118,7 @@ std::vector<TString> ConvertToStrings(
118
118
}
119
119
120
120
// ! A handy shortcut with the default formatter.
121
- template <class TIter >
121
+ template <std::forward_iterator TIter>
122
122
std::vector<TString> ConvertToStrings (
123
123
const TIter& begin,
124
124
const TIter& end,
@@ -133,9 +133,9 @@ std::vector<TString> ConvertToStrings(
133
133
* \param formatter Formatter to apply to the items.
134
134
* \param maxSize Size limit for the resulting vector.
135
135
*/
136
- template <class TCollection , class TFormatter >
136
+ template <std::ranges::range TCollection, class TFormatter >
137
137
std::vector<TString> ConvertToStrings (
138
- const TCollection& collection,
138
+ TCollection& & collection,
139
139
const TFormatter& formatter,
140
140
size_t maxSize)
141
141
{
@@ -145,12 +145,12 @@ std::vector<TString> ConvertToStrings(
145
145
}
146
146
147
147
// ! A handy shortcut with default formatter.
148
- template <class TCollection >
148
+ template <std::ranges::range TCollection>
149
149
std::vector<TString> ConvertToStrings (
150
- const TCollection& collection,
150
+ TCollection& & collection,
151
151
size_t maxSize)
152
152
{
153
- return ConvertToStrings (collection, TDefaultFormatter (), maxSize);
153
+ return ConvertToStrings (std::forward<TCollection>( collection) , TDefaultFormatter (), maxSize);
154
154
}
155
155
156
156
// //////////////////////////////////////////////////////////////////////////////
0 commit comments