aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/string/string-inl.h
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2024-10-19 17:59:18 +0000
committerAlexander Smirnov <alex@ydb.tech>2024-10-19 17:59:18 +0000
commitceddbfe68f6ec7949a4062716c8f9840a59c6888 (patch)
treeabfecadbb9c1e5aea40701dd20d902cb7bccd962 /library/cpp/yt/string/string-inl.h
parent07f2e60d02d95eab14a86a4b9469db1af7795001 (diff)
parentd920c750e476fa2dc80c45f990d9456b1afeadd1 (diff)
downloadydb-ceddbfe68f6ec7949a4062716c8f9840a59c6888.tar.gz
Merge branch 'rightlib' into mergelibs-241019-1758
Diffstat (limited to 'library/cpp/yt/string/string-inl.h')
-rw-r--r--library/cpp/yt/string/string-inl.h32
1 files changed, 16 insertions, 16 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);
}
////////////////////////////////////////////////////////////////////////////////