aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Korostelev <ivan.korostelev@gmail.com>2022-02-10 16:46:41 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:41 +0300
commitf3a52f9d3e18d1159abbc85fa65eeda69d971657 (patch)
tree203885df8c9af6c414a9ec107514b91912970ab9
parent99609724f661f7e21d1cb08e8d80e87c3632fdb3 (diff)
downloadydb-f3a52f9d3e18d1159abbc85fa65eeda69d971657.tar.gz
Restoring authorship annotation for Ivan Korostelev <ivan.korostelev@gmail.com>. Commit 1 of 2.
-rw-r--r--contrib/libs/pcre/pcre_config.h2
-rw-r--r--library/cpp/cache/cache.h124
-rw-r--r--library/cpp/cache/ut/cache_ut.cpp14
-rw-r--r--library/cpp/coroutine/engine/events.h2
-rw-r--r--library/cpp/getopt/small/modchooser.h8
-rw-r--r--library/cpp/histogram/adaptive/adaptive_histogram.cpp180
-rw-r--r--library/cpp/histogram/adaptive/adaptive_histogram.h54
-rw-r--r--library/cpp/histogram/adaptive/auto_histogram.h8
-rw-r--r--library/cpp/histogram/adaptive/histogram.h4
-rw-r--r--library/cpp/histogram/adaptive/multi_histogram.h14
-rw-r--r--library/cpp/json/domscheme_traits.h344
-rw-r--r--library/cpp/scheme/domscheme_traits.h338
-rw-r--r--tools/ya.make2
-rw-r--r--util/charset/wide.cpp8
-rw-r--r--util/draft/holder_vector.h2
-rw-r--r--util/generic/maybe.h8
-rw-r--r--util/generic/maybe_ut.cpp22
-rw-r--r--util/network/socket.h10
-rw-r--r--util/string/cast.cpp4
-rw-r--r--util/string/strip.h62
-rw-r--r--util/string/strip_ut.cpp12
-rw-r--r--util/string/util.h2
-rw-r--r--util/thread/pool.cpp4
-rw-r--r--util/thread/pool_ut.cpp4
-rw-r--r--util/ysaveload.h14
25 files changed, 623 insertions, 623 deletions
diff --git a/contrib/libs/pcre/pcre_config.h b/contrib/libs/pcre/pcre_config.h
index 622b2ec59b..1f70369166 100644
--- a/contrib/libs/pcre/pcre_config.h
+++ b/contrib/libs/pcre/pcre_config.h
@@ -301,7 +301,7 @@ sure both macros are undefined; an emulation function will then be used. */
/* Define to any value to allow pcregrep to be linked with libbz2, so that it
is able to handle .bz2 files. */
/* #undef SUPPORT_LIBBZ2 */
-
+
/* Define to any value to allow pcretest to be linked with libedit. */
/* #undef SUPPORT_LIBEDIT */
diff --git a/library/cpp/cache/cache.h b/library/cpp/cache/cache.h
index 6dc997076d..eed990bf97 100644
--- a/library/cpp/cache/cache.h
+++ b/library/cpp/cache/cache.h
@@ -24,8 +24,8 @@ public:
, ItemsAmount(0)
, TotalSize(0)
, MaxSize(maxSize)
- {
- }
+ {
+ }
public:
struct TItem: public TIntrusiveListItem<TItem> {
@@ -34,20 +34,20 @@ public:
: TBase()
, Key(key)
, Value(value)
- {
- }
+ {
+ }
TItem(const TItem& rhs)
: TBase()
, Key(rhs.Key)
, Value(rhs.Value)
- {
- }
+ {
+ }
bool operator<(const TItem& rhs) const {
return Key < rhs.Key;
}
-
+
bool operator==(const TItem& rhs) const {
return Key == rhs.Key;
}
@@ -58,13 +58,13 @@ public:
struct THash {
size_t operator()(const TItem& item) const {
return ::THash<TKey>()(item.Key);
- }
+ }
};
};
public:
TItem* Insert(TItem* item) {
- List.PushBack(item);
+ List.PushBack(item);
++ItemsAmount;
TotalSize += SizeProvider(item->Value);
@@ -74,32 +74,32 @@ public:
TItem* RemoveIfOverflown() {
TItem* deleted = nullptr;
if (TotalSize > MaxSize && ItemsAmount > 1) {
- deleted = GetOldest();
- Erase(deleted);
+ deleted = GetOldest();
+ Erase(deleted);
}
- return deleted;
+ return deleted;
}
-
+
TItem* GetOldest() {
typename TListType::TIterator it = List.Begin();
Y_ASSERT(it != List.End());
return &*it;
}
-
+
void Erase(TItem* item) {
item->Unlink();
--ItemsAmount;
TotalSize -= SizeProvider(item->Value);
}
-
+
void Promote(TItem* item) {
item->Unlink();
- List.PushBack(item);
+ List.PushBack(item);
}
-
- size_t GetSize() const {
+
+ size_t GetSize() const {
return ItemsAmount;
- }
+ }
size_t GetTotalSize() const {
return TotalSize;
@@ -386,13 +386,13 @@ public:
public:
explicit TIterator(const TIndexConstIterator& iter)
: Iter(iter)
- {
- }
-
+ {
+ }
+
TValue& operator*() {
return const_cast<TValue&>(Iter->Value);
}
-
+
TValue* operator->() {
return const_cast<TValue*>(&Iter->Value);
}
@@ -400,11 +400,11 @@ public:
bool operator==(const TIterator& rhs) const {
return Iter == rhs.Iter;
}
-
+
bool operator!=(const TIterator& rhs) const {
return Iter != rhs.Iter;
}
-
+
TIterator& operator++() {
++Iter;
return *this;
@@ -431,10 +431,10 @@ public:
{
}
- ~TCache() {
- Clear();
- }
-
+ ~TCache() {
+ Clear();
+ }
+
size_t Size() const {
return Index.size();
}
@@ -473,8 +473,8 @@ public:
bool Insert(const std::pair<TKey, TValue>& p) {
return Insert(p.first, p.second);
- }
-
+ }
+
bool Insert(const TKey& key, const TValue& value) {
TItem tmpItem(key, value);
if (!MultiValue && Index.find(tmpItem) != Index.end())
@@ -495,42 +495,42 @@ public:
Y_ASSERT(Index.size() == List.GetSize());
return !insertedWasRemoved;
}
-
- void Update(const TKey& key, const TValue& value) {
+
+ void Update(const TKey& key, const TValue& value) {
if (MultiValue)
ythrow yexception() << "TCache: can't \"Update\" in multicache";
- TIterator it = Find(key);
- if (it != End()) {
- Erase(it);
- }
- Insert(key, value);
-
+ TIterator it = Find(key);
+ if (it != End()) {
+ Erase(it);
+ }
+ Insert(key, value);
+
Y_ASSERT(Index.size() == List.GetSize());
- }
-
+ }
+
void Erase(TIterator it) {
- TItem* item = const_cast<TItem*>(&*it.Iter);
- List.Erase(item);
- TDeleter::Destroy(item->Value);
+ TItem* item = const_cast<TItem*>(&*it.Iter);
+ List.Erase(item);
+ TDeleter::Destroy(item->Value);
Index.erase(it.Iter);
-
+
Y_ASSERT(Index.size() == List.GetSize());
}
-
+
bool Empty() const {
return Index.empty();
}
-
- void Clear() {
- for (TIndexIterator it = Index.begin(); it != Index.end(); ++it) {
- TItem* item = const_cast<TItem*>(&*it);
- List.Erase(item);
- TDeleter::Destroy(item->Value);
- }
+
+ void Clear() {
+ for (TIndexIterator it = Index.begin(); it != Index.end(); ++it) {
+ TItem* item = const_cast<TItem*>(&*it);
+ List.Erase(item);
+ TDeleter::Destroy(item->Value);
+ }
Y_ASSERT(List.GetSize() == 0);
- Index.clear();
- }
-
+ Index.clear();
+ }
+
void SetMaxSize(size_t newSize) {
List.SetMaxSize(newSize);
@@ -549,7 +549,7 @@ protected:
TIndex Index;
TListType List;
bool MultiValue;
-
+
TIterator FindByItem(TItem* item) {
std::pair<TIndexIterator, TIndexIterator> p = Index.equal_range(*item);
// we have to delete the exact unlinked item (there may be multiple items for one key)
@@ -560,12 +560,12 @@ protected:
return (it == p.second ? End() : TIterator(it));
}
- void EraseFromIndex(TItem* item) {
- TDeleter::Destroy(item->Value);
+ void EraseFromIndex(TItem* item) {
+ TDeleter::Destroy(item->Value);
TIterator it = FindByItem(item);
Y_ASSERT(it != End());
Index.erase(it.Iter);
- }
+ }
};
struct TNoopDelete {
@@ -582,8 +582,8 @@ class TLRUCache: public TCache<TKey, TValue, TLRUList<TKey, TValue, TSizeProvide
public:
TLRUCache(size_t maxSize, bool multiValue = false, const TSizeProvider& sizeProvider = TSizeProvider())
: TBase(TListType(maxSize, sizeProvider), multiValue)
- {
- }
+ {
+ }
public:
typedef typename TBase::TIterator TIterator;
diff --git a/library/cpp/cache/ut/cache_ut.cpp b/library/cpp/cache/ut/cache_ut.cpp
index 329872cfde..7491b76c9d 100644
--- a/library/cpp/cache/ut/cache_ut.cpp
+++ b/library/cpp/cache/ut/cache_ut.cpp
@@ -131,11 +131,11 @@ Y_UNIT_TEST_SUITE(TCacheTest) {
UNIT_ASSERT(s.Find(3) != s.End());
UNIT_ASSERT(*s.Find(3) == "hjkl");
- UNIT_ASSERT(!s.Insert(3, "abcd"));
- UNIT_ASSERT(*s.Find(3) == "hjkl");
- s.Update(3, "abcd");
- UNIT_ASSERT(*s.Find(3) == "abcd");
-
+ UNIT_ASSERT(!s.Insert(3, "abcd"));
+ UNIT_ASSERT(*s.Find(3) == "hjkl");
+ s.Update(3, "abcd");
+ UNIT_ASSERT(*s.Find(3) == "abcd");
+
TCache::TIterator it = s.Find(3);
s.Erase(it);
UNIT_ASSERT(s.Find(3) == s.End());
@@ -332,7 +332,7 @@ Y_UNIT_TEST_SUITE(TCacheTest) {
}
};
int TMyDelete::count = 0;
-
+
Y_UNIT_TEST(DeleterTest) {
typedef TLRUCache<int, TString, TMyDelete> TCache;
TCache s(2);
@@ -345,7 +345,7 @@ Y_UNIT_TEST_SUITE(TCacheTest) {
s.Erase(it);
UNIT_ASSERT(TMyDelete::count == 2);
}
-
+
Y_UNIT_TEST(PromoteOnFind) {
typedef TLRUCache<int, TString> TCache;
TCache s(2);
diff --git a/library/cpp/coroutine/engine/events.h b/library/cpp/coroutine/engine/events.h
index 07cc4d25e8..2d7db781ca 100644
--- a/library/cpp/coroutine/engine/events.h
+++ b/library/cpp/coroutine/engine/events.h
@@ -101,7 +101,7 @@ public:
}
void BroadCast(size_t number) noexcept {
- for (size_t i = 0; i < number && !Waiters_.Empty(); ++i) {
+ for (size_t i = 0; i < number && !Waiters_.Empty(); ++i) {
Waiters_.PopFront()->Wake();
}
}
diff --git a/library/cpp/getopt/small/modchooser.h b/library/cpp/getopt/small/modchooser.h
index 0a8de6d50b..67f3fe3fc0 100644
--- a/library/cpp/getopt/small/modchooser.h
+++ b/library/cpp/getopt/small/modchooser.h
@@ -86,14 +86,14 @@ public:
/*! Run appropriate mode.
*
- * In this method following things happen:
+ * In this method following things happen:
* 1) If first argument is -h/--help/-? then print short description of
* all modes and exit with zero code.
* 2) If first argument is -v/--version and version handler is specified,
- * then call it and exit with zero code.
+ * then call it and exit with zero code.
* 3) Find mode with the same name as first argument. If it's found then
- * call it and return its return code.
- * 4) If appropriate mode is not found - return non-zero code.
+ * call it and return its return code.
+ * 4) If appropriate mode is not found - return non-zero code.
*/
int Run(int argc, const char** argv) const;
diff --git a/library/cpp/histogram/adaptive/adaptive_histogram.cpp b/library/cpp/histogram/adaptive/adaptive_histogram.cpp
index cbfc494021..8cc0323135 100644
--- a/library/cpp/histogram/adaptive/adaptive_histogram.cpp
+++ b/library/cpp/histogram/adaptive/adaptive_histogram.cpp
@@ -1,12 +1,12 @@
#include "adaptive_histogram.h"
-#include <util/generic/algorithm.h>
+#include <util/generic/algorithm.h>
#include <util/generic/yexception.h>
#include <util/generic/ymath.h>
#include <util/string/printf.h>
-#include <util/system/backtrace.h>
-
+#include <util/system/backtrace.h>
+
namespace NKiwiAggr {
TAdaptiveHistogram::TAdaptiveHistogram(size_t intervals, ui64 id, TQualityFunction qualityFunc)
: Id(id)
@@ -64,7 +64,7 @@ namespace NKiwiAggr {
}
TWeightedValue weightedValue(value, weight);
Add(weightedValue, true);
- PrecomputedBins.clear();
+ PrecomputedBins.clear();
}
void TAdaptiveHistogram::Merge(const THistogram& histo, double multiplier) {
@@ -294,25 +294,25 @@ namespace NKiwiAggr {
if (bound > MaxValue) {
return 0.0;
}
-
- if (!PrecomputedBins.empty()) {
- return GetSumAboveBoundImpl(
- bound,
- PrecomputedBins,
- LowerBound(PrecomputedBins.begin(), PrecomputedBins.end(), TFastBin{bound, -1.0, 0, 0}),
+
+ if (!PrecomputedBins.empty()) {
+ return GetSumAboveBoundImpl(
+ bound,
+ PrecomputedBins,
+ LowerBound(PrecomputedBins.begin(), PrecomputedBins.end(), TFastBin{bound, -1.0, 0, 0}),
[](const auto& it) { return it->SumAbove; });
- } else {
- return GetSumAboveBoundImpl(
- bound,
- Bins,
- Bins.lower_bound(TWeightedValue(bound, -1.0)),
- [this](TPairSet::const_iterator rightBin) {
- ++rightBin;
- double sum = 0;
- for (TPairSet::const_iterator it = rightBin; it != Bins.end(); ++it) {
- sum += it->second;
- }
- return sum;
+ } else {
+ return GetSumAboveBoundImpl(
+ bound,
+ Bins,
+ Bins.lower_bound(TWeightedValue(bound, -1.0)),
+ [this](TPairSet::const_iterator rightBin) {
+ ++rightBin;
+ double sum = 0;
+ for (TPairSet::const_iterator it = rightBin; it != Bins.end(); ++it) {
+ sum += it->second;
+ }
+ return sum;
});
}
}
@@ -327,24 +327,24 @@ namespace NKiwiAggr {
if (bound > MaxValue) {
return Sum;
}
-
- if (!PrecomputedBins.empty()) {
- return GetSumBelowBoundImpl(
- bound,
- PrecomputedBins,
- LowerBound(PrecomputedBins.begin(), PrecomputedBins.end(), TFastBin{bound, -1.0, 0, 0}),
+
+ if (!PrecomputedBins.empty()) {
+ return GetSumBelowBoundImpl(
+ bound,
+ PrecomputedBins,
+ LowerBound(PrecomputedBins.begin(), PrecomputedBins.end(), TFastBin{bound, -1.0, 0, 0}),
[](const auto& it) { return it->SumBelow; });
- } else {
- return GetSumBelowBoundImpl(
- bound,
- Bins,
- Bins.lower_bound(TWeightedValue(bound, -1.0)),
- [this](TPairSet::const_iterator rightBin) {
- double sum = 0;
- for (TPairSet::iterator it = Bins.begin(); it != rightBin; ++it) {
- sum += it->second;
- }
- return sum;
+ } else {
+ return GetSumBelowBoundImpl(
+ bound,
+ Bins,
+ Bins.lower_bound(TWeightedValue(bound, -1.0)),
+ [this](TPairSet::const_iterator rightBin) {
+ double sum = 0;
+ for (TPairSet::iterator it = Bins.begin(); it != rightBin; ++it) {
+ sum += it->second;
+ }
+ return sum;
});
}
}
@@ -583,55 +583,55 @@ namespace NKiwiAggr {
Add(newBin, false);
}
- void TAdaptiveHistogram::PrecomputePartialSums() {
- PrecomputedBins.clear();
- PrecomputedBins.reserve(Bins.size());
- double currentSum = 0;
- for (const auto& bin : Bins) {
- PrecomputedBins.emplace_back(bin.first, bin.second, currentSum, Sum - currentSum - bin.second);
- currentSum += bin.second;
- }
- }
-
- template <typename TBins, typename TGetSumAbove>
- double TAdaptiveHistogram::GetSumAboveBoundImpl(double bound, const TBins& bins, typename TBins::const_iterator rightBin, const TGetSumAbove& getSumAbove) const {
- typename TBins::value_type left(MinValue, 0.0);
- typename TBins::value_type right(MaxValue, 0.0);
- if (rightBin != bins.end()) {
- right = *rightBin;
- }
- if (rightBin != bins.begin()) {
- typename TBins::const_iterator leftBin = rightBin;
- --leftBin;
- left = *leftBin;
- }
- double sum = (right.second / 2) + ((right.first == left.first) ? ((left.second + right.second) / 2) : (((left.second + right.second) / 2) * (right.first - bound) / (right.first - left.first)));
- if (rightBin == bins.end()) {
- return sum;
- }
- sum += getSumAbove(rightBin);
- return sum;
- }
-
- template <typename TBins, typename TGetSumBelow>
- double TAdaptiveHistogram::GetSumBelowBoundImpl(double bound, const TBins& bins, typename TBins::const_iterator rightBin, const TGetSumBelow& getSumBelow) const {
- typename TBins::value_type left(MinValue, 0.0);
- typename TBins::value_type right(MaxValue, 0.0);
- if (rightBin != bins.end()) {
- right = *rightBin;
- }
- if (rightBin != bins.begin()) {
- typename TBins::const_iterator leftBin = rightBin;
- --leftBin;
- left = *leftBin;
- }
- double sum = (left.second / 2) + ((right.first == left.first) ? ((left.second + right.second) / 2) : (((left.second + right.second) / 2) * (bound - left.first) / (right.first - left.first)));
- if (rightBin == bins.begin()) {
- return sum;
- }
- --rightBin;
- sum += getSumBelow(rightBin);
- return sum;
- }
-
+ void TAdaptiveHistogram::PrecomputePartialSums() {
+ PrecomputedBins.clear();
+ PrecomputedBins.reserve(Bins.size());
+ double currentSum = 0;
+ for (const auto& bin : Bins) {
+ PrecomputedBins.emplace_back(bin.first, bin.second, currentSum, Sum - currentSum - bin.second);
+ currentSum += bin.second;
+ }
+ }
+
+ template <typename TBins, typename TGetSumAbove>
+ double TAdaptiveHistogram::GetSumAboveBoundImpl(double bound, const TBins& bins, typename TBins::const_iterator rightBin, const TGetSumAbove& getSumAbove) const {
+ typename TBins::value_type left(MinValue, 0.0);
+ typename TBins::value_type right(MaxValue, 0.0);
+ if (rightBin != bins.end()) {
+ right = *rightBin;
+ }
+ if (rightBin != bins.begin()) {
+ typename TBins::const_iterator leftBin = rightBin;
+ --leftBin;
+ left = *leftBin;
+ }
+ double sum = (right.second / 2) + ((right.first == left.first) ? ((left.second + right.second) / 2) : (((left.second + right.second) / 2) * (right.first - bound) / (right.first - left.first)));
+ if (rightBin == bins.end()) {
+ return sum;
+ }
+ sum += getSumAbove(rightBin);
+ return sum;
+ }
+
+ template <typename TBins, typename TGetSumBelow>
+ double TAdaptiveHistogram::GetSumBelowBoundImpl(double bound, const TBins& bins, typename TBins::const_iterator rightBin, const TGetSumBelow& getSumBelow) const {
+ typename TBins::value_type left(MinValue, 0.0);
+ typename TBins::value_type right(MaxValue, 0.0);
+ if (rightBin != bins.end()) {
+ right = *rightBin;
+ }
+ if (rightBin != bins.begin()) {
+ typename TBins::const_iterator leftBin = rightBin;
+ --leftBin;
+ left = *leftBin;
+ }
+ double sum = (left.second / 2) + ((right.first == left.first) ? ((left.second + right.second) / 2) : (((left.second + right.second) / 2) * (bound - left.first) / (right.first - left.first)));
+ if (rightBin == bins.begin()) {
+ return sum;
+ }
+ --rightBin;
+ sum += getSumBelow(rightBin);
+ return sum;
+ }
+
}
diff --git a/library/cpp/histogram/adaptive/adaptive_histogram.h b/library/cpp/histogram/adaptive/adaptive_histogram.h
index fa8f48433f..2c057ff2a1 100644
--- a/library/cpp/histogram/adaptive/adaptive_histogram.h
+++ b/library/cpp/histogram/adaptive/adaptive_histogram.h
@@ -17,27 +17,27 @@ namespace NKiwiAggr {
private:
using TPairSet = TSet<TWeightedValue>;
- struct TFastBin {
- // these names are for compatibility with TWeightedValue
- double first;
- double second;
- // both sums do not include current bin
- double SumBelow;
- double SumAbove;
-
+ struct TFastBin {
+ // these names are for compatibility with TWeightedValue
+ double first;
+ double second;
+ // both sums do not include current bin
+ double SumBelow;
+ double SumAbove;
+
TFastBin(double first_, double second_, double sumBelow = 0, double sumAbove = 0)
- : first(first_)
- , second(second_)
- , SumBelow(sumBelow)
- , SumAbove(sumAbove)
- {
- }
-
+ : first(first_)
+ , second(second_)
+ , SumBelow(sumBelow)
+ , SumAbove(sumAbove)
+ {
+ }
+
bool operator<(const TFastBin& rhs) const {
- return first < rhs.first;
- }
- };
-
+ return first < rhs.first;
+ }
+ };
+
ui64 Id;
double MinValue;
double MaxValue;
@@ -48,7 +48,7 @@ namespace NKiwiAggr {
TQualityFunction CalcQuality;
TVector<TFastBin> PrecomputedBins;
-
+
public:
TAdaptiveHistogram(size_t intervals, ui64 id = 0, TQualityFunction qualityFunc = CalcWeightQuality);
TAdaptiveHistogram(const THistogram& histo, size_t defaultIntervals = DEFAULT_INTERVALS, ui64 defaultId = 0, TQualityFunction qualityFunc = nullptr);
@@ -88,18 +88,18 @@ namespace NKiwiAggr {
double CalcLowerBoundSafe(double sum) final;
void PrecomputePartialSums() final;
-
+
private:
void FromIHistogram(IHistogram* histo);
void Add(const TWeightedValue& weightedValue, bool initial);
void Erase(double value);
void Shrink();
-
- template <typename TBins, typename TGetSumAbove>
- double GetSumAboveBoundImpl(double bound, const TBins& bins, typename TBins::const_iterator rightBin, const TGetSumAbove& getSumAbove) const;
-
- template <typename TBins, typename TGetSumBelow>
- double GetSumBelowBoundImpl(double bound, const TBins& bins, typename TBins::const_iterator rightBin, const TGetSumBelow& getSumBelow) const;
+
+ template <typename TBins, typename TGetSumAbove>
+ double GetSumAboveBoundImpl(double bound, const TBins& bins, typename TBins::const_iterator rightBin, const TGetSumAbove& getSumAbove) const;
+
+ template <typename TBins, typename TGetSumBelow>
+ double GetSumBelowBoundImpl(double bound, const TBins& bins, typename TBins::const_iterator rightBin, const TGetSumBelow& getSumBelow) const;
};
template <TQualityFunction QualityFunction>
diff --git a/library/cpp/histogram/adaptive/auto_histogram.h b/library/cpp/histogram/adaptive/auto_histogram.h
index 9fdf0b9abe..4c2c6b8bde 100644
--- a/library/cpp/histogram/adaptive/auto_histogram.h
+++ b/library/cpp/histogram/adaptive/auto_histogram.h
@@ -139,10 +139,10 @@ namespace NKiwiAggr {
virtual double CalcLowerBoundSafe(double sum) {
return HistogramImpl->CalcLowerBoundSafe(sum);
}
-
- virtual void PrecomputePartialSums() {
- return HistogramImpl->PrecomputePartialSums();
- }
+
+ virtual void PrecomputePartialSums() {
+ return HistogramImpl->PrecomputePartialSums();
+ }
};
}
diff --git a/library/cpp/histogram/adaptive/histogram.h b/library/cpp/histogram/adaptive/histogram.h
index 360fd9a693..639a9c0445 100644
--- a/library/cpp/histogram/adaptive/histogram.h
+++ b/library/cpp/histogram/adaptive/histogram.h
@@ -57,8 +57,8 @@ namespace NKiwiAggr {
double GetValueAtPercentileSafe(double percentile) {
return CalcUpperBoundSafe(percentile * GetSum());
}
-
- // Histogram implementation is supposed to clear all precomputed values() if Add() is called after PrecomputePartialSums()
+
+ // Histogram implementation is supposed to clear all precomputed values() if Add() is called after PrecomputePartialSums()
virtual void PrecomputePartialSums() {
}
};
diff --git a/library/cpp/histogram/adaptive/multi_histogram.h b/library/cpp/histogram/adaptive/multi_histogram.h
index 41caac5ba6..af5778718f 100644
--- a/library/cpp/histogram/adaptive/multi_histogram.h
+++ b/library/cpp/histogram/adaptive/multi_histogram.h
@@ -5,7 +5,7 @@
#include <library/cpp/histogram/adaptive/protos/histo.pb.h>
-#include <util/generic/hash.h>
+#include <util/generic/hash.h>
#include <util/generic/ptr.h>
#include <utility>
@@ -119,12 +119,12 @@ namespace NKiwiAggr {
it->second->ToProto(*histo);
}
}
-
- void PrecomputePartialSums() {
- for (auto& it : Histograms) {
- it.second->PrecomputePartialSums();
- }
- }
+
+ void PrecomputePartialSums() {
+ for (auto& it : Histograms) {
+ it.second->PrecomputePartialSums();
+ }
+ }
};
template <class TMerger, class TSomeMultiHistogram>
diff --git a/library/cpp/json/domscheme_traits.h b/library/cpp/json/domscheme_traits.h
index a5a99cd8cf..5d6077f270 100644
--- a/library/cpp/json/domscheme_traits.h
+++ b/library/cpp/json/domscheme_traits.h
@@ -1,16 +1,16 @@
-#pragma once
-
+#pragma once
+
#include "json_value.h"
#include "json_reader.h"
-#include "json_writer.h"
-#include <util/generic/algorithm.h>
-
-struct TJsonTraits {
+#include "json_writer.h"
+#include <util/generic/algorithm.h>
+
+struct TJsonTraits {
using TValue = NJson::TJsonValue;
using TValueRef = TValue*;
using TConstValueRef = const TValue*;
using TStringType = TStringBuf;
-
+
// anyvalue defaults
template <class T>
static inline TValue Value(T&& t) {
@@ -32,110 +32,110 @@ struct TJsonTraits {
return &v;
}
- // common ops
- static inline bool IsNull(TConstValueRef v) {
- return v->GetType() == NJson::JSON_UNDEFINED || v->IsNull();
- }
-
- static inline TString ToJson(TConstValueRef v) {
- return NJson::WriteJson(v, false);
- }
-
- // struct ops
- static inline TValueRef GetField(TValueRef v, const TStringBuf& name) {
- return &(*v)[name];
- }
-
- static inline TConstValueRef GetField(TConstValueRef v, const TStringBuf& name) {
- return &(*v)[name];
- }
-
- // array ops
- static bool IsArray(TConstValueRef v) {
- return v->IsArray();
- }
-
- static inline void ArrayClear(TValueRef v) {
- v->SetType(NJson::JSON_NULL);
- v->SetType(NJson::JSON_ARRAY);
- }
-
+ // common ops
+ static inline bool IsNull(TConstValueRef v) {
+ return v->GetType() == NJson::JSON_UNDEFINED || v->IsNull();
+ }
+
+ static inline TString ToJson(TConstValueRef v) {
+ return NJson::WriteJson(v, false);
+ }
+
+ // struct ops
+ static inline TValueRef GetField(TValueRef v, const TStringBuf& name) {
+ return &(*v)[name];
+ }
+
+ static inline TConstValueRef GetField(TConstValueRef v, const TStringBuf& name) {
+ return &(*v)[name];
+ }
+
+ // array ops
+ static bool IsArray(TConstValueRef v) {
+ return v->IsArray();
+ }
+
+ static inline void ArrayClear(TValueRef v) {
+ v->SetType(NJson::JSON_NULL);
+ v->SetType(NJson::JSON_ARRAY);
+ }
+
using TArrayIterator = size_t;
static inline TValueRef ArrayElement(TValueRef v, TArrayIterator n) {
- return &(*v)[n];
- }
-
+ return &(*v)[n];
+ }
+
static inline TConstValueRef ArrayElement(TConstValueRef v, TArrayIterator n) {
- return &(*v)[n];
- }
-
- static inline size_t ArraySize(TConstValueRef v) {
- return v->GetArray().size();
- }
-
- static inline TArrayIterator ArrayBegin(TConstValueRef) {
- return 0;
- }
-
- static inline TArrayIterator ArrayEnd(TConstValueRef v) {
- return ArraySize(v);
- }
-
- // dict ops
- static bool IsDict(TConstValueRef v) {
- return v->IsMap();
- }
-
- static inline void DictClear(TValueRef v) {
- v->SetType(NJson::JSON_NULL);
- v->SetType(NJson::JSON_MAP);
- }
-
- static inline TValueRef DictElement(TValueRef v, TStringBuf key) {
- return &(*v)[key];
- }
-
- static inline TConstValueRef DictElement(TConstValueRef v, TStringBuf key) {
- return &(*v)[key];
- }
-
+ return &(*v)[n];
+ }
+
+ static inline size_t ArraySize(TConstValueRef v) {
+ return v->GetArray().size();
+ }
+
+ static inline TArrayIterator ArrayBegin(TConstValueRef) {
+ return 0;
+ }
+
+ static inline TArrayIterator ArrayEnd(TConstValueRef v) {
+ return ArraySize(v);
+ }
+
+ // dict ops
+ static bool IsDict(TConstValueRef v) {
+ return v->IsMap();
+ }
+
+ static inline void DictClear(TValueRef v) {
+ v->SetType(NJson::JSON_NULL);
+ v->SetType(NJson::JSON_MAP);
+ }
+
+ static inline TValueRef DictElement(TValueRef v, TStringBuf key) {
+ return &(*v)[key];
+ }
+
+ static inline TConstValueRef DictElement(TConstValueRef v, TStringBuf key) {
+ return &(*v)[key];
+ }
+
static inline size_t DictSize(TConstValueRef v) {
- return v->GetMap().size();
- }
-
+ return v->GetMap().size();
+ }
+
using TDictIterator = NJson::TJsonValue::TMapType::const_iterator;
-
- static inline TDictIterator DictBegin(TConstValueRef v) {
- return v->GetMap().begin();
- }
-
- static inline TDictIterator DictEnd(TConstValueRef v) {
- return v->GetMap().end();
- }
-
- static inline TStringBuf DictIteratorKey(TConstValueRef /*dict*/, const TDictIterator& it) {
- return it->first;
- }
-
- static inline TConstValueRef DictIteratorValue(TConstValueRef /*dict*/, const TDictIterator& it) {
- return &it->second;
- }
-
- // boolean ops
- static inline void Get(TConstValueRef v, bool def, bool& b) {
- b =
+
+ static inline TDictIterator DictBegin(TConstValueRef v) {
+ return v->GetMap().begin();
+ }
+
+ static inline TDictIterator DictEnd(TConstValueRef v) {
+ return v->GetMap().end();
+ }
+
+ static inline TStringBuf DictIteratorKey(TConstValueRef /*dict*/, const TDictIterator& it) {
+ return it->first;
+ }
+
+ static inline TConstValueRef DictIteratorValue(TConstValueRef /*dict*/, const TDictIterator& it) {
+ return &it->second;
+ }
+
+ // boolean ops
+ static inline void Get(TConstValueRef v, bool def, bool& b) {
+ b =
v->GetType() == NJson::JSON_UNDEFINED ? def : v->IsNull() ? def : v->GetBooleanRobust();
- }
-
- static inline void Get(TConstValueRef v, bool& b) {
- Get(v, false, b);
- }
-
- static inline bool IsValidPrimitive(const bool&, TConstValueRef v) {
- return v->IsBoolean();
- }
-
+ }
+
+ static inline void Get(TConstValueRef v, bool& b) {
+ Get(v, false, b);
+ }
+
+ static inline bool IsValidPrimitive(const bool&, TConstValueRef v) {
+ return v->IsBoolean();
+ }
+
#define INTEGER_OPS(type, checkOp, getOp) \
static inline void Get(TConstValueRef v, type def, type& i) { \
i = v->checkOp() ? v->getOp() : def; \
@@ -144,73 +144,73 @@ struct TJsonTraits {
i = v->getOp(); \
} \
static inline bool IsValidPrimitive(const type&, TConstValueRef v) { \
- return v->checkOp() && v->getOp() >= Min<type>() && v->getOp() <= Max<type>(); \
- }
-
- INTEGER_OPS(i8, IsInteger, GetInteger)
- INTEGER_OPS(i16, IsInteger, GetInteger)
- INTEGER_OPS(i32, IsInteger, GetInteger)
- INTEGER_OPS(i64, IsInteger, GetInteger)
- INTEGER_OPS(ui8, IsUInteger, GetUInteger)
- INTEGER_OPS(ui16, IsUInteger, GetUInteger)
- INTEGER_OPS(ui32, IsUInteger, GetUInteger)
- INTEGER_OPS(ui64, IsUInteger, GetUInteger)
-
-#undef INTEGER_OPS
-
- // double ops
- static inline bool Get(TConstValueRef v, double def, double& d) {
- if (v->IsDouble()) {
- d = v->GetDouble();
- return true;
- }
- d = def;
- return false;
- }
-
- static inline void Get(TConstValueRef v, double& d) {
- d = v->GetDouble();
- }
-
- static inline bool IsValidPrimitive(const double&, TConstValueRef v) {
- return v->IsDouble();
- }
-
- // string ops
- static inline void Get(TConstValueRef v, TStringBuf def, TStringBuf& s) {
- s = v->IsString() ? v->GetString() : def;
- }
-
- static inline void Get(TConstValueRef v, TStringBuf& s) {
- s = v->GetString();
- }
-
- static inline bool IsValidPrimitive(const TStringBuf&, TConstValueRef v) {
- return v->IsString();
- }
-
- // generic set
- template <class T>
- static inline void Set(TValueRef v, T&& t) {
- v->SetValue(t);
- }
-
- static inline void Clear(TValueRef v) {
- v->SetType(NJson::JSON_NULL);
- }
-
- // validation ops
+ return v->checkOp() && v->getOp() >= Min<type>() && v->getOp() <= Max<type>(); \
+ }
+
+ INTEGER_OPS(i8, IsInteger, GetInteger)
+ INTEGER_OPS(i16, IsInteger, GetInteger)
+ INTEGER_OPS(i32, IsInteger, GetInteger)
+ INTEGER_OPS(i64, IsInteger, GetInteger)
+ INTEGER_OPS(ui8, IsUInteger, GetUInteger)
+ INTEGER_OPS(ui16, IsUInteger, GetUInteger)
+ INTEGER_OPS(ui32, IsUInteger, GetUInteger)
+ INTEGER_OPS(ui64, IsUInteger, GetUInteger)
+
+#undef INTEGER_OPS
+
+ // double ops
+ static inline bool Get(TConstValueRef v, double def, double& d) {
+ if (v->IsDouble()) {
+ d = v->GetDouble();
+ return true;
+ }
+ d = def;
+ return false;
+ }
+
+ static inline void Get(TConstValueRef v, double& d) {
+ d = v->GetDouble();
+ }
+
+ static inline bool IsValidPrimitive(const double&, TConstValueRef v) {
+ return v->IsDouble();
+ }
+
+ // string ops
+ static inline void Get(TConstValueRef v, TStringBuf def, TStringBuf& s) {
+ s = v->IsString() ? v->GetString() : def;
+ }
+
+ static inline void Get(TConstValueRef v, TStringBuf& s) {
+ s = v->GetString();
+ }
+
+ static inline bool IsValidPrimitive(const TStringBuf&, TConstValueRef v) {
+ return v->IsString();
+ }
+
+ // generic set
+ template <class T>
+ static inline void Set(TValueRef v, T&& t) {
+ v->SetValue(t);
+ }
+
+ static inline void Clear(TValueRef v) {
+ v->SetType(NJson::JSON_NULL);
+ }
+
+ // validation ops
static inline TVector<TString> GetKeys(TConstValueRef v) {
TVector<TString> res;
- for (const auto& it : v->GetMap()) {
- res.push_back(it.first);
- }
- Sort(res.begin(), res.end());
- return res;
- }
-
- template <typename T>
- static inline bool IsValidPrimitive(const T&, TConstValueRef) {
- return false;
- }
-};
+ for (const auto& it : v->GetMap()) {
+ res.push_back(it.first);
+ }
+ Sort(res.begin(), res.end());
+ return res;
+ }
+
+ template <typename T>
+ static inline bool IsValidPrimitive(const T&, TConstValueRef) {
+ return false;
+ }
+};
diff --git a/library/cpp/scheme/domscheme_traits.h b/library/cpp/scheme/domscheme_traits.h
index a11c4dd444..500cadf9c8 100644
--- a/library/cpp/scheme/domscheme_traits.h
+++ b/library/cpp/scheme/domscheme_traits.h
@@ -1,14 +1,14 @@
-#pragma once
-
+#pragma once
+
#include "scheme.h"
#include <util/string/cast.h>
-
-struct TSchemeTraits {
+
+struct TSchemeTraits {
using TValue = NSc::TValue;
using TValueRef = TValue*;
using TConstValueRef = const TValue*;
using TStringType = TStringBuf;
-
+
// anyvalue defaults
template <class T>
static inline TValue Value(T&& t) {
@@ -28,113 +28,113 @@ struct TSchemeTraits {
return &v;
}
- // common ops
- static inline bool IsNull(TConstValueRef v) {
- return v->IsNull();
- }
-
- static inline TString ToJson(TConstValueRef v) {
- return v->ToJson();
- }
-
- // struct ops
- static inline TValueRef GetField(TValueRef v, const TStringBuf& name) {
- return &(*v)[name];
- }
-
- static inline TConstValueRef GetField(TConstValueRef v, const TStringBuf& name) {
- return &(*v)[name];
- }
-
- // array ops
- static bool IsArray(TConstValueRef v) {
- return v->IsArray();
- }
-
- static inline void ArrayClear(TValueRef v) {
+ // common ops
+ static inline bool IsNull(TConstValueRef v) {
+ return v->IsNull();
+ }
+
+ static inline TString ToJson(TConstValueRef v) {
+ return v->ToJson();
+ }
+
+ // struct ops
+ static inline TValueRef GetField(TValueRef v, const TStringBuf& name) {
+ return &(*v)[name];
+ }
+
+ static inline TConstValueRef GetField(TConstValueRef v, const TStringBuf& name) {
+ return &(*v)[name];
+ }
+
+ // array ops
+ static bool IsArray(TConstValueRef v) {
+ return v->IsArray();
+ }
+
+ static inline void ArrayClear(TValueRef v) {
v->SetArray();
- v->ClearArray();
- }
-
+ v->ClearArray();
+ }
+
using TArrayIterator = size_t;
static inline TValueRef ArrayElement(TValueRef v, TArrayIterator n) {
- return &(*v)[n];
- }
-
+ return &(*v)[n];
+ }
+
static inline TConstValueRef ArrayElement(TConstValueRef v, TArrayIterator n) {
- return &(*v)[n];
- }
-
- static inline size_t ArraySize(TConstValueRef v) {
- return v->GetArray().size();
- }
-
- static inline TArrayIterator ArrayBegin(TConstValueRef) {
- return 0;
- }
-
- static inline TArrayIterator ArrayEnd(TConstValueRef v) {
- return ArraySize(v);
- }
-
- // dict ops
- static bool IsDict(TConstValueRef v) {
- return v->IsDict();
- }
-
- static inline void DictClear(TValueRef v) {
+ return &(*v)[n];
+ }
+
+ static inline size_t ArraySize(TConstValueRef v) {
+ return v->GetArray().size();
+ }
+
+ static inline TArrayIterator ArrayBegin(TConstValueRef) {
+ return 0;
+ }
+
+ static inline TArrayIterator ArrayEnd(TConstValueRef v) {
+ return ArraySize(v);
+ }
+
+ // dict ops
+ static bool IsDict(TConstValueRef v) {
+ return v->IsDict();
+ }
+
+ static inline void DictClear(TValueRef v) {
v->SetDict();
- v->ClearDict();
- }
-
- static inline TValueRef DictElement(TValueRef v, TStringBuf key) {
- return &(*v)[key];
- }
-
- static inline TConstValueRef DictElement(TConstValueRef v, TStringBuf key) {
- return &(*v)[key];
- }
-
+ v->ClearDict();
+ }
+
+ static inline TValueRef DictElement(TValueRef v, TStringBuf key) {
+ return &(*v)[key];
+ }
+
+ static inline TConstValueRef DictElement(TConstValueRef v, TStringBuf key) {
+ return &(*v)[key];
+ }
+
static inline size_t DictSize(TConstValueRef v) {
return v->GetDict().size();
- }
-
- using TDictIterator = NSc::TDict::const_iterator;
-
- static inline TDictIterator DictBegin(TConstValueRef v) {
- return v->GetDict().begin();
- }
-
- static inline TDictIterator DictEnd(TConstValueRef v) {
- return v->GetDict().end();
- }
-
- static inline TStringBuf DictIteratorKey(TConstValueRef /*dict*/, const TDictIterator& it) {
- return it->first;
- }
-
- static inline TConstValueRef DictIteratorValue(TConstValueRef /*dict*/, const TDictIterator& it) {
- return &it->second;
- }
-
- // boolean ops
- static inline void Get(TConstValueRef v, bool def, bool& b) {
- b = def == true ? !v->IsExplicitFalse() : v->IsTrue();
- }
-
- static inline void Get(TConstValueRef v, bool& b) {
- b = v->IsTrue();
- }
-
- static inline void Set(TValueRef v, bool b) {
- v->SetIntNumber(b ? 1 : 0);
- }
-
- static inline bool IsValidPrimitive(const bool&, TConstValueRef v) {
- return v->IsTrue() || v->IsExplicitFalse();
- }
-
+ }
+
+ using TDictIterator = NSc::TDict::const_iterator;
+
+ static inline TDictIterator DictBegin(TConstValueRef v) {
+ return v->GetDict().begin();
+ }
+
+ static inline TDictIterator DictEnd(TConstValueRef v) {
+ return v->GetDict().end();
+ }
+
+ static inline TStringBuf DictIteratorKey(TConstValueRef /*dict*/, const TDictIterator& it) {
+ return it->first;
+ }
+
+ static inline TConstValueRef DictIteratorValue(TConstValueRef /*dict*/, const TDictIterator& it) {
+ return &it->second;
+ }
+
+ // boolean ops
+ static inline void Get(TConstValueRef v, bool def, bool& b) {
+ b = def == true ? !v->IsExplicitFalse() : v->IsTrue();
+ }
+
+ static inline void Get(TConstValueRef v, bool& b) {
+ b = v->IsTrue();
+ }
+
+ static inline void Set(TValueRef v, bool b) {
+ v->SetIntNumber(b ? 1 : 0);
+ }
+
+ static inline bool IsValidPrimitive(const bool&, TConstValueRef v) {
+ return v->IsTrue() || v->IsExplicitFalse();
+ }
+
#define INTEGER_OPS_EX(type, min, max, isUnsigned) \
static inline void Get(TConstValueRef v, type def, type& i) { \
if (isUnsigned) { \
@@ -157,72 +157,72 @@ struct TSchemeTraits {
} \
static inline void Set(TValueRef v, type i) { \
v->SetIntNumber(i); \
- }
-
-#define INTEGER_OPS(type, isUnsigned) INTEGER_OPS_EX(type, Min<type>(), Max<type>(), isUnsigned)
-
- INTEGER_OPS(i8, false)
- INTEGER_OPS(i16, false)
- INTEGER_OPS(i32, false)
- INTEGER_OPS(i64, false)
- INTEGER_OPS(ui8, true)
- INTEGER_OPS(ui16, true)
- INTEGER_OPS(ui32, true)
+ }
+
+#define INTEGER_OPS(type, isUnsigned) INTEGER_OPS_EX(type, Min<type>(), Max<type>(), isUnsigned)
+
+ INTEGER_OPS(i8, false)
+ INTEGER_OPS(i16, false)
+ INTEGER_OPS(i32, false)
+ INTEGER_OPS(i64, false)
+ INTEGER_OPS(ui8, true)
+ INTEGER_OPS(ui16, true)
+ INTEGER_OPS(ui32, true)
INTEGER_OPS_EX(ui64, 0, (i64)(Max<i64>() >> 1), true)
-
-#undef INTEGER_OPS
-#undef INTEGER_OPS_EX
-
- // double ops
- static inline bool Get(TConstValueRef v, double def, double& d) {
- if (v->IsNumber()) {
- d = v->GetNumber(def);
- return true;
- }
- d = def;
- return false;
- }
-
- static inline void Get(TConstValueRef v, double& d) {
- d = v->GetNumber();
- }
-
- static inline void Set(TValueRef v, double d) {
- v->SetNumber(d);
- }
-
- static inline bool IsValidPrimitive(const double&, TConstValueRef v) {
- return v->IsNumber();
- }
-
- // string ops
- static inline void Get(TConstValueRef v, TStringBuf def, TStringBuf& s) {
- s = v->GetString(def);
- }
-
- static inline void Get(TConstValueRef v, TStringBuf& s) {
- s = v->GetString();
- }
-
- static inline void Set(TValueRef v, TStringBuf s) {
- v->SetString(s);
- }
-
- static inline bool IsValidPrimitive(const TStringBuf&, TConstValueRef v) {
- return v->IsString();
- }
-
- // validation ops
+
+#undef INTEGER_OPS
+#undef INTEGER_OPS_EX
+
+ // double ops
+ static inline bool Get(TConstValueRef v, double def, double& d) {
+ if (v->IsNumber()) {
+ d = v->GetNumber(def);
+ return true;
+ }
+ d = def;
+ return false;
+ }
+
+ static inline void Get(TConstValueRef v, double& d) {
+ d = v->GetNumber();
+ }
+
+ static inline void Set(TValueRef v, double d) {
+ v->SetNumber(d);
+ }
+
+ static inline bool IsValidPrimitive(const double&, TConstValueRef v) {
+ return v->IsNumber();
+ }
+
+ // string ops
+ static inline void Get(TConstValueRef v, TStringBuf def, TStringBuf& s) {
+ s = v->GetString(def);
+ }
+
+ static inline void Get(TConstValueRef v, TStringBuf& s) {
+ s = v->GetString();
+ }
+
+ static inline void Set(TValueRef v, TStringBuf s) {
+ v->SetString(s);
+ }
+
+ static inline bool IsValidPrimitive(const TStringBuf&, TConstValueRef v) {
+ return v->IsString();
+ }
+
+ // validation ops
static inline TVector<TString> GetKeys(TConstValueRef v) {
TVector<TString> res;
- for (const auto& key : v->DictKeys(true)) {
+ for (const auto& key : v->DictKeys(true)) {
res.push_back(ToString(key));
- }
- return res;
- }
-
- template <typename T>
- static inline bool IsValidPrimitive(const T&, TConstValueRef) {
- return false;
- }
-};
+ }
+ return res;
+ }
+
+ template <typename T>
+ static inline bool IsValidPrimitive(const T&, TConstValueRef) {
+ return false;
+ }
+};
diff --git a/tools/ya.make b/tools/ya.make
index 51a6b8b426..b643b85c6d 100644
--- a/tools/ya.make
+++ b/tools/ya.make
@@ -29,7 +29,7 @@ RECURSE(
doc_handle_decode/ut
doc_url_index_print
dolbilo
- domschemec
+ domschemec
domschemec/ut
drawrichtree
dsindexer
diff --git a/util/charset/wide.cpp b/util/charset/wide.cpp
index a287438ddd..25ba822ce7 100644
--- a/util/charset/wide.cpp
+++ b/util/charset/wide.cpp
@@ -1,8 +1,8 @@
#include "wide.h"
#include <util/generic/mem_copy.h>
-#include <util/string/strip.h>
-
+#include <util/string/strip.h>
+
namespace {
//! the constants are not zero-terminated
const wchar16 LT[] = {'&', 'l', 't', ';'};
@@ -32,11 +32,11 @@ namespace {
}
void Collapse(TUtf16String& w) {
- CollapseImpl(w, w, 0, IsWhitespace);
+ CollapseImpl(w, w, 0, IsWhitespace);
}
size_t Collapse(wchar16* s, size_t n) {
- return CollapseImpl(s, n, IsWhitespace);
+ return CollapseImpl(s, n, IsWhitespace);
}
TWtringBuf StripLeft(const TWtringBuf text) noexcept {
diff --git a/util/draft/holder_vector.h b/util/draft/holder_vector.h
index 1c62055bd9..651a171a50 100644
--- a/util/draft/holder_vector.h
+++ b/util/draft/holder_vector.h
@@ -73,7 +73,7 @@ public:
void Resize(size_t newSize) {
for (size_t i = newSize; i < size(); ++i) {
- D::Destroy((*this)[i]);
+ D::Destroy((*this)[i]);
}
TBase::resize(newSize);
}
diff --git a/util/generic/maybe.h b/util/generic/maybe.h
index 34d21aebcd..1e21f07e9c 100644
--- a/util/generic/maybe.h
+++ b/util/generic/maybe.h
@@ -447,7 +447,7 @@ private:
this->Defined_ = true;
}
};
-
+
template <class T>
using TMaybeFail = TMaybe<T, NMaybe::TPolicyUndefinedFail>;
@@ -492,12 +492,12 @@ constexpr bool operator==(const ::TMaybe<T, TPolicy>& left, const ::TMaybe<T, TP
!static_cast<bool>(left)
? true
: *left == *right);
-}
-
+}
+
template <class T, class TPolicy>
constexpr bool operator!=(const TMaybe<T, TPolicy>& left, const TMaybe<T, TPolicy>& right) {
return !(left == right);
-}
+}
template <class T, class TPolicy>
constexpr bool operator<(const TMaybe<T, TPolicy>& left, const TMaybe<T, TPolicy>& right) {
diff --git a/util/generic/maybe_ut.cpp b/util/generic/maybe_ut.cpp
index 2c1a425c5e..597e725819 100644
--- a/util/generic/maybe_ut.cpp
+++ b/util/generic/maybe_ut.cpp
@@ -103,7 +103,7 @@ Y_UNIT_TEST_SUITE(TMaybeTest) {
UNIT_ASSERT(!m5.Defined());
UNIT_ASSERT(m5.Empty());
UNIT_ASSERT(m5 == TMaybe<int>());
- UNIT_ASSERT(m5 == Nothing());
+ UNIT_ASSERT(m5 == Nothing());
UNIT_ASSERT(m5 != TMaybe<int>(4));
m5 = 4;
@@ -115,7 +115,7 @@ Y_UNIT_TEST_SUITE(TMaybeTest) {
UNIT_ASSERT(m5 == TMaybe<int>(4));
UNIT_ASSERT(m5 != TMaybe<int>(3));
UNIT_ASSERT(m5 != TMaybe<int>());
- UNIT_ASSERT(m5 != Nothing());
+ UNIT_ASSERT(m5 != Nothing());
m5 = TMaybe<int>(5);
UNIT_ASSERT(m5.Defined());
@@ -126,16 +126,16 @@ Y_UNIT_TEST_SUITE(TMaybeTest) {
m5 = TMaybe<int>();
UNIT_ASSERT(m5.Empty());
UNIT_ASSERT(m5 == TMaybe<int>());
- UNIT_ASSERT(m5 == Nothing());
- UNIT_ASSERT(m5 != TMaybe<int>(5));
-
- m5 = 4;
- m5 = Nothing();
-
- UNIT_ASSERT(m5.Empty());
- UNIT_ASSERT(m5 == TMaybe<int>());
- UNIT_ASSERT(m5 == Nothing());
+ UNIT_ASSERT(m5 == Nothing());
UNIT_ASSERT(m5 != TMaybe<int>(5));
+
+ m5 = 4;
+ m5 = Nothing();
+
+ UNIT_ASSERT(m5.Empty());
+ UNIT_ASSERT(m5 == TMaybe<int>());
+ UNIT_ASSERT(m5 == Nothing());
+ UNIT_ASSERT(m5 != TMaybe<int>(5));
m5 = {};
UNIT_ASSERT(m5.Empty());
diff --git a/util/network/socket.h b/util/network/socket.h
index 40c8648b40..b0a2d1aeaf 100644
--- a/util/network/socket.h
+++ b/util/network/socket.h
@@ -234,8 +234,8 @@ private:
TSimpleIntrusivePtr<TImpl> Impl_;
};
-class TSocket;
-
+class TSocket;
+
class TSocketHolder: public TMoveOnly {
public:
inline TSocketHolder()
@@ -290,9 +290,9 @@ public:
private:
SOCKET Fd_;
-
- // do not allow construction of TSocketHolder from TSocket
- TSocketHolder(const TSocket& fd);
+
+ // do not allow construction of TSocketHolder from TSocket
+ TSocketHolder(const TSocket& fd);
};
class TSocket {
diff --git a/util/string/cast.cpp b/util/string/cast.cpp
index aa1e65a8e9..eda6fd4ee8 100644
--- a/util/string/cast.cpp
+++ b/util/string/cast.cpp
@@ -468,8 +468,8 @@ DEF_INT_SPEC_I(wchar32, ui64) // wchar32 is always unsigned
return FormatFlt<type>(t, buf, len); \
}
-DEF_FLT_SPEC(long double)
-
+DEF_FLT_SPEC(long double)
+
#undef DEF_FLT_SPEC
template <>
diff --git a/util/string/strip.h b/util/string/strip.h
index d5ef6da96d..f462e8a17f 100644
--- a/util/string/strip.h
+++ b/util/string/strip.h
@@ -196,40 +196,40 @@ inline TString Strip(const TString& s) {
return ret;
}
-template <class TChar, class TWhitespaceFunc>
-size_t CollapseImpl(TChar* s, size_t n, const TWhitespaceFunc& isWhitespace) {
- size_t newLen = 0;
- for (size_t i = 0; i < n; ++i, ++newLen) {
- size_t nextNonSpace = i;
- while (nextNonSpace < n && isWhitespace(s[nextNonSpace])) {
- ++nextNonSpace;
- }
- size_t numSpaces = nextNonSpace - i;
- if (numSpaces > 1 || (numSpaces == 1 && s[i] != ' ')) {
- s[newLen] = ' ';
- i = nextNonSpace - 1;
- } else {
- s[newLen] = s[i];
- }
- }
- return newLen;
-}
-
+template <class TChar, class TWhitespaceFunc>
+size_t CollapseImpl(TChar* s, size_t n, const TWhitespaceFunc& isWhitespace) {
+ size_t newLen = 0;
+ for (size_t i = 0; i < n; ++i, ++newLen) {
+ size_t nextNonSpace = i;
+ while (nextNonSpace < n && isWhitespace(s[nextNonSpace])) {
+ ++nextNonSpace;
+ }
+ size_t numSpaces = nextNonSpace - i;
+ if (numSpaces > 1 || (numSpaces == 1 && s[i] != ' ')) {
+ s[newLen] = ' ';
+ i = nextNonSpace - 1;
+ } else {
+ s[newLen] = s[i];
+ }
+ }
+ return newLen;
+}
+
template <class TStringType, class TWhitespaceFunc>
bool CollapseImpl(const TStringType& from, TStringType& to, size_t maxLen, const TWhitespaceFunc& isWhitespace) {
- to = from;
+ to = from;
maxLen = maxLen ? Min(maxLen, to.size()) : to.size();
- for (size_t i = 0; i < maxLen; ++i) {
- if (isWhitespace(to[i]) && (to[i] != ' ' || isWhitespace(to[i + 1]))) {
- size_t tailSize = maxLen - i;
- size_t newTailSize = CollapseImpl(to.begin() + i, tailSize, isWhitespace);
- to.remove(i + newTailSize, tailSize - newTailSize);
- return true;
- }
- }
- return false;
-}
-
+ for (size_t i = 0; i < maxLen; ++i) {
+ if (isWhitespace(to[i]) && (to[i] != ' ' || isWhitespace(to[i + 1]))) {
+ size_t tailSize = maxLen - i;
+ size_t newTailSize = CollapseImpl(to.begin() + i, tailSize, isWhitespace);
+ to.remove(i + newTailSize, tailSize - newTailSize);
+ return true;
+ }
+ }
+ return false;
+}
+
bool Collapse(const TString& from, TString& to, size_t maxLen = 0);
/// Replaces several consequtive space symbols with one (processing is limited to maxLen bytes)
diff --git a/util/string/strip_ut.cpp b/util/string/strip_ut.cpp
index d1029d1498..58f0a9e3df 100644
--- a/util/string/strip_ut.cpp
+++ b/util/string/strip_ut.cpp
@@ -110,17 +110,17 @@ Y_UNIT_TEST_SUITE(TStripStringTest) {
Y_UNIT_TEST(TestCollapse) {
TString s;
Collapse(TString(" 123 456 "), s);
- UNIT_ASSERT(s == " 123 456 ");
+ UNIT_ASSERT(s == " 123 456 ");
Collapse(TString(" 123 456 "), s, 10);
- UNIT_ASSERT(s == " 123 456 ");
-
+ UNIT_ASSERT(s == " 123 456 ");
+
s = TString(" a b c ");
TString s2 = s;
CollapseInPlace(s2);
-
- UNIT_ASSERT(s == s2);
+
+ UNIT_ASSERT(s == s2);
#ifndef TSTRING_IS_STD_STRING
- UNIT_ASSERT(s.c_str() == s2.c_str()); // Collapse() does not change the string at all
+ UNIT_ASSERT(s.c_str() == s2.c_str()); // Collapse() does not change the string at all
#endif
}
diff --git a/util/string/util.h b/util/string/util.h
index 0d77a5042b..b806bbf5c7 100644
--- a/util/string/util.h
+++ b/util/string/util.h
@@ -3,7 +3,7 @@
//THIS FILE A COMPAT STUB HEADER
#include <cstring>
-#include <cstdarg>
+#include <cstdarg>
#include <algorithm>
#include <util/system/defaults.h>
diff --git a/util/thread/pool.cpp b/util/thread/pool.cpp
index 05fad02e9b..911ed3a276 100644
--- a/util/thread/pool.cpp
+++ b/util/thread/pool.cpp
@@ -175,7 +175,7 @@ private:
inline void Stop() {
AtomicSet(ShouldTerminate, 1);
-
+
with_lock (QueueMutex) {
QueuePopCond.BroadCast();
}
@@ -224,7 +224,7 @@ private:
job = Queue.Pop();
}
-
+
QueuePopCond.Signal();
if (Catching) {
diff --git a/util/thread/pool_ut.cpp b/util/thread/pool_ut.cpp
index 893770d0c4..4c73d23947 100644
--- a/util/thread/pool_ut.cpp
+++ b/util/thread/pool_ut.cpp
@@ -72,13 +72,13 @@ struct TThreadPoolTest {
UNIT_ASSERT_EQUAL(0, R);
}
};
-
+
class TFailAddQueue: public IThreadPool {
public:
bool Add(IObjectInQueue* /*obj*/) override Y_WARN_UNUSED_RESULT {
return false;
}
-
+
void Start(size_t, size_t) override {
}
diff --git a/util/ysaveload.h b/util/ysaveload.h
index 02efb4049b..7cf1583075 100644
--- a/util/ysaveload.h
+++ b/util/ysaveload.h
@@ -382,22 +382,22 @@ template <class T, class A>
class TSerializer<std::deque<T, A>>: public TVectorSerializer<std::deque<T, A>> {
};
-template <class TArray>
+template <class TArray>
class TStdArraySerializer {
public:
static inline void Save(IOutputStream* rh, const TArray& a) {
::SaveArray(rh, a.data(), a.size());
}
-
+
static inline void Load(IInputStream* rh, TArray& a) {
::LoadArray(rh, a.data(), a.size());
}
-};
-
-template <class T, size_t N>
+};
+
+template <class T, size_t N>
class TSerializer<std::array<T, N>>: public TStdArraySerializer<std::array<T, N>> {
-};
-
+};
+
template <class A, class B>
class TSerializer<std::pair<A, B>> {
using TPair = std::pair<A, B>;