aboutsummaryrefslogtreecommitdiffstats
path: root/util/string/join.h
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/string/join.h
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/string/join.h')
-rw-r--r--util/string/join.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/util/string/join.h b/util/string/join.h
index b166fad1f3..9a735ceb29 100644
--- a/util/string/join.h
+++ b/util/string/join.h
@@ -3,7 +3,7 @@
#include <util/generic/string.h>
#include <util/generic/typetraits.h>
#include <util/string/cast.h>
-#include "cast.h"
+#include "cast.h"
/*
* Default implementation of AppendToString uses a temporary TString object which is inefficient. You can overload it
@@ -201,43 +201,43 @@ JoinSeq(TCharType delim, const TContainer& data) {
* 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 {
+template <class TIterB, class TIterE>
+struct TRangeJoiner {
friend constexpr IOutputStream& operator<<(IOutputStream& stream, const TRangeJoiner<TIterB, TIterE>& rangeJoiner) {
- if (rangeJoiner.b != rangeJoiner.e) {
+ if (rangeJoiner.b != rangeJoiner.e) {
stream << *rangeJoiner.b;
- for (auto it = std::next(rangeJoiner.b); it != rangeJoiner.e; ++it)
+ for (auto it = std::next(rangeJoiner.b); it != rangeJoiner.e; ++it)
stream << rangeJoiner.delim << *it;
}
return stream;
}
- constexpr TRangeJoiner(TStringBuf delim, TIterB&& b, TIterE&& e)
- : delim(delim)
- , b(std::forward<TIterB>(b))
- , e(std::forward<TIterE>(e))
- {
- }
-
+ constexpr TRangeJoiner(TStringBuf delim, TIterB&& b, TIterE&& e)
+ : delim(delim)
+ , b(std::forward<TIterB>(b))
+ , e(std::forward<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) {
+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));
}
-template <class TContainer>
-constexpr auto MakeRangeJoiner(TStringBuf delim, const TContainer& data) {
+template <class TContainer>
+constexpr auto MakeRangeJoiner(TStringBuf delim, const TContainer& data) {
return MakeRangeJoiner(delim, std::cbegin(data), std::cend(data));
}
-template <class TVal>
-constexpr auto MakeRangeJoiner(TStringBuf delim, const std::initializer_list<TVal>& data) {
+template <class TVal>
+constexpr auto MakeRangeJoiner(TStringBuf delim, const std::initializer_list<TVal>& data) {
return MakeRangeJoiner(delim, std::cbegin(data), std::cend(data));
}
@@ -253,9 +253,9 @@ constexpr auto MakeRangeJoiner(TStringBuf delim, const std::initializer_list<TVa
*/
template <typename T>
-inline std::enable_if_t<
- !std::is_same<std::decay_t<T>, TString>::value && !std::is_same<std::decay_t<T>, const char*>::value,
- TString>
+inline std::enable_if_t<
+ !std::is_same<std::decay_t<T>, TString>::value && !std::is_same<std::decay_t<T>, const char*>::value,
+ TString>
JoinSeq(const TStringBuf delim, const std::initializer_list<T>& data) {
return JoinRange(delim, data.begin(), data.end());
}