aboutsummaryrefslogtreecommitdiffstats
path: root/util/string/join.h
diff options
context:
space:
mode:
authorluckybug <luckybug@yandex-team.ru>2022-02-10 16:50:27 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:27 +0300
commitb455da0978714a8b8dd026fc564b36dea5948f79 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/string/join.h
parenta6d369648d0e4e2d446acfd469aced762d3c0492 (diff)
downloadydb-b455da0978714a8b8dd026fc564b36dea5948f79.tar.gz
Restoring authorship annotation for <luckybug@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/string/join.h')
-rw-r--r--util/string/join.h54
1 files changed, 27 insertions, 27 deletions
diff --git a/util/string/join.h b/util/string/join.h
index 595674b58e..b166fad1f3 100644
--- a/util/string/join.h
+++ b/util/string/join.h
@@ -197,22 +197,22 @@ JoinSeq(TCharType delim, const TContainer& data) {
return JoinSeq(delimBuf, data);
}
-/** \brief Functor for streaming iterative objects from TIterB e to TIterE b, separated with delim.
- * Difference from JoinSeq, JoinRange, Join is the lack of TString object - all depends on operator<< for the type and
- * realization of IOutputStream
- */
+/** \brief Functor for streaming iterative objects from TIterB e to TIterE b, separated with delim.
+ * Difference from JoinSeq, JoinRange, Join is the lack of TString object - all depends on operator<< for the type and
+ * realization of IOutputStream
+ */
template <class TIterB, class TIterE>
struct TRangeJoiner {
- friend constexpr IOutputStream& operator<<(IOutputStream& stream, const TRangeJoiner<TIterB, TIterE>& rangeJoiner) {
+ friend constexpr IOutputStream& operator<<(IOutputStream& stream, const TRangeJoiner<TIterB, TIterE>& rangeJoiner) {
if (rangeJoiner.b != rangeJoiner.e) {
- stream << *rangeJoiner.b;
-
+ stream << *rangeJoiner.b;
+
for (auto it = std::next(rangeJoiner.b); it != rangeJoiner.e; ++it)
- stream << rangeJoiner.delim << *it;
- }
- return stream;
- }
-
+ stream << rangeJoiner.delim << *it;
+ }
+ return stream;
+ }
+
constexpr TRangeJoiner(TStringBuf delim, TIterB&& b, TIterE&& e)
: delim(delim)
, b(std::forward<TIterB>(b))
@@ -220,27 +220,27 @@ struct TRangeJoiner {
{
}
-private:
- const TStringBuf delim;
- const TIterB b;
- const TIterE e;
-};
-
+private:
+ const TStringBuf delim;
+ const TIterB b;
+ const TIterE e;
+};
+
template <class TIterB, class TIterE = TIterB>
constexpr auto MakeRangeJoiner(TStringBuf delim, TIterB&& b, TIterE&& e) {
- return TRangeJoiner<TIterB, TIterE>(delim, std::forward<TIterB>(b), std::forward<TIterE>(e));
-}
-
+ return TRangeJoiner<TIterB, TIterE>(delim, std::forward<TIterB>(b), std::forward<TIterE>(e));
+}
+
template <class TContainer>
constexpr auto MakeRangeJoiner(TStringBuf delim, const TContainer& data) {
- return MakeRangeJoiner(delim, std::cbegin(data), std::cend(data));
-}
-
+ return MakeRangeJoiner(delim, std::cbegin(data), std::cend(data));
+}
+
template <class TVal>
constexpr auto MakeRangeJoiner(TStringBuf delim, const std::initializer_list<TVal>& data) {
- return MakeRangeJoiner(delim, std::cbegin(data), std::cend(data));
-}
-
+ return MakeRangeJoiner(delim, std::cbegin(data), std::cend(data));
+}
+
/* We force (std::initializer_list<TStringBuf>) input type for (TString) and (const char*) types because:
* # When (std::initializer_list<TString>) is used, TString objects are copied into the initializer_list object.
* Storing TStringBufs instead is faster, even with COW-enabled strings.