diff options
author | osado <osado@yandex-team.ru> | 2022-02-10 16:49:18 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:18 +0300 |
commit | 3ed175181ceac225ee14e4519492ad2967a7bd73 (patch) | |
tree | a1a8375fb33669212c8d4f3eb2e50f4f719b6533 | |
parent | 883d905c560ebed4b7f38d021b424d75c4521a6f (diff) | |
download | ydb-3ed175181ceac225ee14e4519492ad2967a7bd73.tar.gz |
Restoring authorship annotation for <osado@yandex-team.ru>. Commit 1 of 2.
25 files changed, 282 insertions, 282 deletions
diff --git a/library/cpp/json/writer/json_value_ut.cpp b/library/cpp/json/writer/json_value_ut.cpp index dc7f6affdf..f11861f10e 100644 --- a/library/cpp/json/writer/json_value_ut.cpp +++ b/library/cpp/json/writer/json_value_ut.cpp @@ -599,14 +599,14 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) { GetMapPointer(outer, "x", &map); UNIT_ASSERT_VALUES_EQUAL((*map).at("b"), 2); } - + Y_UNIT_TEST(GetIntegerRobustBignumStringTest) { TString value = "1626862681464633683"; - TJsonValue json(value); - UNIT_ASSERT_VALUES_EQUAL(json.GetUIntegerRobust(), FromString<ui64>(value)); - UNIT_ASSERT_VALUES_EQUAL(json.GetIntegerRobust(), FromString<i64>(value)); - } - + TJsonValue json(value); + UNIT_ASSERT_VALUES_EQUAL(json.GetUIntegerRobust(), FromString<ui64>(value)); + UNIT_ASSERT_VALUES_EQUAL(json.GetIntegerRobust(), FromString<i64>(value)); + } + Y_UNIT_TEST(MoveSubpartToSelf) { TJsonValue json; json[0] = "testing 0"; diff --git a/library/cpp/monlib/dynamic_counters/golovan_page.cpp b/library/cpp/monlib/dynamic_counters/golovan_page.cpp index 49cf2d39bb..3a8f29b261 100644 --- a/library/cpp/monlib/dynamic_counters/golovan_page.cpp +++ b/library/cpp/monlib/dynamic_counters/golovan_page.cpp @@ -31,7 +31,7 @@ public: out << "[\"" << prefix + value; if (counter->ForDerivative()) { - out << "_dmmm"; + out << "_dmmm"; } else { out << "_ahhh"; } diff --git a/library/cpp/retry/retry.cpp b/library/cpp/retry/retry.cpp index 92466cdeca..cafe54177d 100644 --- a/library/cpp/retry/retry.cpp +++ b/library/cpp/retry/retry.cpp @@ -2,7 +2,7 @@ #include <util/stream/output.h> -void DoWithRetry(std::function<void()> func, TRetryOptions retryOptions) { +void DoWithRetry(std::function<void()> func, TRetryOptions retryOptions) { DoWithRetry(func, retryOptions, true); } diff --git a/library/cpp/retry/retry.h b/library/cpp/retry/retry.h index c47ff5070f..7c1566de60 100644 --- a/library/cpp/retry/retry.h +++ b/library/cpp/retry/retry.h @@ -1,7 +1,7 @@ #pragma once -#include "utils.h" - +#include "utils.h" + #include <library/cpp/retry/protos/retry_options.pb.h> #include <util/datetime/base.h> @@ -10,11 +10,11 @@ #include <util/generic/yexception.h> #include <functional> -struct TRetryOptions { - ui32 RetryCount; +struct TRetryOptions { + ui32 RetryCount; // TotalDuration = SleepDuration +/- SleepRandomDelta + (attempt * SleepIncrement) + (2**attempt * SleepExponentialMultiplier) - TDuration SleepDuration; + TDuration SleepDuration; TDuration SleepRandomDelta; TDuration SleepIncrement; TDuration SleepExponentialMultiplier; @@ -24,35 +24,35 @@ struct TRetryOptions { TRetryOptions(ui32 retryCount = 3, TDuration sleepDuration = TDuration::Seconds(1), TDuration sleepRandomDelta = TDuration::Zero(), TDuration sleepIncrement = TDuration::Zero(), TDuration sleepExponentialMultiplier = TDuration::Zero(), std::function<void(TDuration)> sleepFunction = [](TDuration d) { Sleep(d); }) // can't use Sleep itself due to Win compilation error - : RetryCount(retryCount) - , SleepDuration(sleepDuration) - , SleepRandomDelta(sleepRandomDelta) + : RetryCount(retryCount) + , SleepDuration(sleepDuration) + , SleepRandomDelta(sleepRandomDelta) , SleepIncrement(sleepIncrement) , SleepExponentialMultiplier(sleepExponentialMultiplier) , SleepFunction(sleepFunction) - { - } + { + } TRetryOptions& WithCount(ui32 retryCount) { - RetryCount = retryCount; - return *this; - } - - TRetryOptions& WithSleep(TDuration sleepDuration) { - SleepDuration = sleepDuration; - return *this; - } - - TRetryOptions& WithRandomDelta(TDuration sleepRandomDelta) { - SleepRandomDelta = sleepRandomDelta; - return *this; - } - + RetryCount = retryCount; + return *this; + } + + TRetryOptions& WithSleep(TDuration sleepDuration) { + SleepDuration = sleepDuration; + return *this; + } + + TRetryOptions& WithRandomDelta(TDuration sleepRandomDelta) { + SleepRandomDelta = sleepRandomDelta; + return *this; + } + TRetryOptions& WithIncrement(TDuration sleepIncrement) { SleepIncrement = sleepIncrement; return *this; - } - + } + TRetryOptions& WithExponentialMultiplier(TDuration sleepExponentialMultiplier) { SleepExponentialMultiplier = sleepExponentialMultiplier; return *this; @@ -68,45 +68,45 @@ struct TRetryOptions { return SleepDuration + NRetryPrivate::AddRandomDelta(SleepRandomDelta) + NRetryPrivate::AddIncrement(attempt, SleepIncrement) + NRetryPrivate::AddExponentialMultiplier(attempt, SleepExponentialMultiplier); } - static TRetryOptions Count(ui32 retryCount) { - return TRetryOptions(retryCount); - } + static TRetryOptions Count(ui32 retryCount) { + return TRetryOptions(retryCount); + } - static TRetryOptions Default() { - return TRetryOptions(); + static TRetryOptions Default() { + return TRetryOptions(); } - static TRetryOptions NoRetry() { - return TRetryOptions(0); + static TRetryOptions NoRetry() { + return TRetryOptions(0); } -}; +}; -template <typename TResult, typename TException = yexception> +template <typename TResult, typename TException = yexception> TMaybe<TResult> DoWithRetry(std::function<TResult()> func, std::function<void(const TException&)> onFail, TRetryOptions retryOptions, bool throwLast) { - for (ui32 attempt = 0; attempt <= retryOptions.RetryCount; ++attempt) { - try { - return func(); + for (ui32 attempt = 0; attempt <= retryOptions.RetryCount; ++attempt) { + try { + return func(); } catch (TException& ex) { onFail(ex); - if (attempt == retryOptions.RetryCount) { - if (throwLast) { - throw; + if (attempt == retryOptions.RetryCount) { + if (throwLast) { + throw; } - } else { + } else { auto sleep = retryOptions.SleepFunction; sleep(retryOptions.GetTimeToSleep(attempt)); } } } - return Nothing(); -} + return Nothing(); +} template <typename TResult, typename TException = yexception> TMaybe<TResult> DoWithRetry(std::function<TResult()> func, TRetryOptions retryOptions, bool throwLast) { return DoWithRetry<TResult, TException>(func, [](const TException&){}, retryOptions, throwLast); } -template <typename TException = yexception> +template <typename TException = yexception> bool DoWithRetry(std::function<void()> func, std::function<void(const TException&)> onFail, TRetryOptions retryOptions, bool throwLast) { auto f = [&]() { func(); @@ -116,15 +116,15 @@ bool DoWithRetry(std::function<void()> func, std::function<void(const TException } template <typename TException = yexception> -bool DoWithRetry(std::function<void()> func, TRetryOptions retryOptions, bool throwLast) { - auto f = [&]() { - func(); - return nullptr; - }; +bool DoWithRetry(std::function<void()> func, TRetryOptions retryOptions, bool throwLast) { + auto f = [&]() { + func(); + return nullptr; + }; return DoWithRetry<void*, TException>(f, [](const TException&){}, retryOptions, throwLast).Defined(); -} +} -void DoWithRetry(std::function<void()> func, TRetryOptions retryOptions); +void DoWithRetry(std::function<void()> func, TRetryOptions retryOptions); bool DoWithRetryOnRetCode(std::function<bool()> func, TRetryOptions retryOptions); diff --git a/library/cpp/retry/utils.cpp b/library/cpp/retry/utils.cpp index 24d943f518..c3e797a68a 100644 --- a/library/cpp/retry/utils.cpp +++ b/library/cpp/retry/utils.cpp @@ -1,15 +1,15 @@ -#include "utils.h" - -#include <util/random/random.h> - +#include "utils.h" + +#include <util/random/random.h> + TDuration NRetryPrivate::AddRandomDelta(TDuration maxDelta) { - if (maxDelta == TDuration::Zero()) { + if (maxDelta == TDuration::Zero()) { return TDuration::Zero(); - } - - const TDuration delta = TDuration::MicroSeconds(RandomNumber(2 * maxDelta.MicroSeconds())); + } + + const TDuration delta = TDuration::MicroSeconds(RandomNumber(2 * maxDelta.MicroSeconds())); return delta - maxDelta; -} +} TDuration NRetryPrivate::AddIncrement(ui32 attempt, TDuration increment) { return TDuration::MicroSeconds(attempt * increment.MicroSeconds()); diff --git a/library/cpp/retry/utils.h b/library/cpp/retry/utils.h index a8fd3d1a89..482bb846e1 100644 --- a/library/cpp/retry/utils.h +++ b/library/cpp/retry/utils.h @@ -1,10 +1,10 @@ -#pragma once - -#include <util/datetime/base.h> - -namespace NRetryPrivate { +#pragma once + +#include <util/datetime/base.h> + +namespace NRetryPrivate { TDuration AddRandomDelta(TDuration delta); TDuration AddIncrement(ui32 attempt, TDuration increment); TDuration AddExponentialMultiplier(ui32 attempt, TDuration exponentialMultiplier); - + } diff --git a/library/cpp/retry/ya.make b/library/cpp/retry/ya.make index 31e0c6a259..43486fa208 100644 --- a/library/cpp/retry/ya.make +++ b/library/cpp/retry/ya.make @@ -1,17 +1,17 @@ -LIBRARY() - +LIBRARY() + OWNER( osado g:yabs-small ) - -SRCS( - retry.cpp - utils.cpp -) - + +SRCS( + retry.cpp + utils.cpp +) + PEERDIR( library/cpp/retry/protos ) -END() +END() diff --git a/library/cpp/scheme/scheme.h b/library/cpp/scheme/scheme.h index 3d7c59f3c9..5548ce4297 100644 --- a/library/cpp/scheme/scheme.h +++ b/library/cpp/scheme/scheme.h @@ -15,7 +15,7 @@ namespace NSc { // todo: try to remove some rarely used methods class TValue { public: - enum class EType { + enum class EType { Null = 0 /* "Null" */, Bool /* "Bool" */, IntNumber /* "Int" */, @@ -396,9 +396,9 @@ namespace NSc { static const TArray& DefaultArray(); static const TDict& DefaultDict(); static const TValue& DefaultValue(); - static const TValue& Null() { - return DefaultValue(); - } + static const TValue& Null() { + return DefaultValue(); + } void DoWriteJsonImpl(IOutputStream&, const TJsonOpts&, NImpl::TKeySortContext&, NImpl::TSelfLoopContext&) const; diff --git a/library/cpp/scheme/scimpl.h b/library/cpp/scheme/scimpl.h index 4f68f16290..b7aaa02592 100644 --- a/library/cpp/scheme/scimpl.h +++ b/library/cpp/scheme/scimpl.h @@ -12,7 +12,7 @@ namespace NSc { TStringBuf String; TDict Dict; TArray Array; - TValue::EType ValueType = TValue::EType::Null; + TValue::EType ValueType = TValue::EType::Null; TScCore(TPoolPtr& p) : Pool(p) @@ -22,31 +22,31 @@ namespace NSc { } bool IsNull() const { - return TValue::EType::Null == ValueType; + return TValue::EType::Null == ValueType; } bool IsBool() const { - return TValue::EType::Bool == ValueType; + return TValue::EType::Bool == ValueType; } bool IsIntNumber() const { - return TValue::EType::IntNumber == ValueType || IsBool(); + return TValue::EType::IntNumber == ValueType || IsBool(); } bool IsNumber() const { - return TValue::EType::FloatNumber == ValueType || IsIntNumber(); + return TValue::EType::FloatNumber == ValueType || IsIntNumber(); } bool IsString() const { - return TValue::EType::String == ValueType; + return TValue::EType::String == ValueType; } bool IsArray() const { - return TValue::EType::Array == ValueType; + return TValue::EType::Array == ValueType; } bool IsDict() const { - return TValue::EType::Dict == ValueType; + return TValue::EType::Dict == ValueType; } bool HasChildren() const { @@ -54,7 +54,7 @@ namespace NSc { } void SetNull() { - ValueType = TValue::EType::Null; + ValueType = TValue::EType::Null; } void SetArray() { @@ -62,7 +62,7 @@ namespace NSc { return; } - ValueType = TValue::EType::Array; + ValueType = TValue::EType::Array; Array.clear(); } @@ -71,22 +71,22 @@ namespace NSc { return; } - ValueType = TValue::EType::Dict; + ValueType = TValue::EType::Dict; Dict.clear(); } void SetNumber(double n) { - ValueType = TValue::EType::FloatNumber; + ValueType = TValue::EType::FloatNumber; FloatNumber = n; } void SetIntNumber(i64 n) { - ValueType = TValue::EType::IntNumber; + ValueType = TValue::EType::IntNumber; IntNumber = n; } void SetBool(bool b) { - ValueType = TValue::EType::Bool; + ValueType = TValue::EType::Bool; IntNumber = b; } @@ -95,7 +95,7 @@ namespace NSc { } void SetOwnedString(TStringBuf s) { - ValueType = TValue::EType::String; + ValueType = TValue::EType::String; String = s; } diff --git a/library/cpp/scheme/util/scheme_holder.cpp b/library/cpp/scheme/util/scheme_holder.cpp index 33232acc50..30f32db09c 100644 --- a/library/cpp/scheme/util/scheme_holder.cpp +++ b/library/cpp/scheme/util/scheme_holder.cpp @@ -1 +1 @@ -#include "scheme_holder.h" +#include "scheme_holder.h" diff --git a/library/cpp/scheme/util/scheme_holder.h b/library/cpp/scheme/util/scheme_holder.h index f2fa16d1cd..eae7e1fcc3 100644 --- a/library/cpp/scheme/util/scheme_holder.h +++ b/library/cpp/scheme/util/scheme_holder.h @@ -1,76 +1,76 @@ -#pragma once - +#pragma once + #include <library/cpp/scheme/scheme.h> - - -// Scheme adapter that holds referenced value -template <typename TScheme> -class TSchemeHolder { -public: - TSchemeHolder() - : Value_(NSc::Null()) - , Scheme_(&Value_) - { - } - - explicit TSchemeHolder(NSc::TValue&& value) - : Value_(std::move(value)) - , Scheme_(&Value_) - { - } - - explicit TSchemeHolder(const NSc::TValue& value) - : Value_(value) - , Scheme_(&Value_) - { - } - - TSchemeHolder(TSchemeHolder<TScheme>&& rhs) - : Value_(std::move(rhs.Value_)) - , Scheme_(&Value_) - { - } - - TSchemeHolder(const TSchemeHolder<TScheme>& rhs) - : Value_(rhs.Value_) - , Scheme_(&Value_) - { - } - - TSchemeHolder<TScheme>& operator=(TSchemeHolder<TScheme>&& rhs) { - Value_ = std::move(rhs.Value_); - return *this; - } - TSchemeHolder<TScheme>& operator=(const TSchemeHolder<TScheme>& rhs) { - Value_ = rhs.Value_; - return *this; - } - - TScheme& Scheme() { - return Scheme_; - } - const TScheme& Scheme() const { - return Scheme_; - } - TScheme& operator->() { - return Scheme_; - } - const TScheme& operator->() const { - return Scheme_; - } - - NSc::TValue& Value() { - return Value_; - } - const NSc::TValue& Value() const { - return Value_; - } - - bool IsNull() const { - return Value_.IsNull(); - } - -private: - NSc::TValue Value_; - TScheme Scheme_; -}; + + +// Scheme adapter that holds referenced value +template <typename TScheme> +class TSchemeHolder { +public: + TSchemeHolder() + : Value_(NSc::Null()) + , Scheme_(&Value_) + { + } + + explicit TSchemeHolder(NSc::TValue&& value) + : Value_(std::move(value)) + , Scheme_(&Value_) + { + } + + explicit TSchemeHolder(const NSc::TValue& value) + : Value_(value) + , Scheme_(&Value_) + { + } + + TSchemeHolder(TSchemeHolder<TScheme>&& rhs) + : Value_(std::move(rhs.Value_)) + , Scheme_(&Value_) + { + } + + TSchemeHolder(const TSchemeHolder<TScheme>& rhs) + : Value_(rhs.Value_) + , Scheme_(&Value_) + { + } + + TSchemeHolder<TScheme>& operator=(TSchemeHolder<TScheme>&& rhs) { + Value_ = std::move(rhs.Value_); + return *this; + } + TSchemeHolder<TScheme>& operator=(const TSchemeHolder<TScheme>& rhs) { + Value_ = rhs.Value_; + return *this; + } + + TScheme& Scheme() { + return Scheme_; + } + const TScheme& Scheme() const { + return Scheme_; + } + TScheme& operator->() { + return Scheme_; + } + const TScheme& operator->() const { + return Scheme_; + } + + NSc::TValue& Value() { + return Value_; + } + const NSc::TValue& Value() const { + return Value_; + } + + bool IsNull() const { + return Value_.IsNull(); + } + +private: + NSc::TValue Value_; + TScheme Scheme_; +}; diff --git a/library/cpp/scheme/util/utils.cpp b/library/cpp/scheme/util/utils.cpp index 40cceceacd..202a9e3166 100644 --- a/library/cpp/scheme/util/utils.cpp +++ b/library/cpp/scheme/util/utils.cpp @@ -1,23 +1,23 @@ -#include "utils.h" - +#include "utils.h" + #include <library/cpp/string_utils/base64/base64.h> - -namespace NScUtils { - -void CopyField(const NSc::TValue& from, NSc::TValue& to) { - to = from; -} - -} // namespace NScUtils - -void TSerializer<NSc::TValue>::Save(IOutputStream* out, const NSc::TValue& v) { - TString json = Base64Encode(v.ToJson()); - ::Save(out, json); -} - -void TSerializer<NSc::TValue>::Load(IInputStream* in, NSc::TValue& v) { - TString json; - ::Load(in, json); - json = Base64Decode(json); - v = NSc::TValue::FromJsonThrow(json); -} + +namespace NScUtils { + +void CopyField(const NSc::TValue& from, NSc::TValue& to) { + to = from; +} + +} // namespace NScUtils + +void TSerializer<NSc::TValue>::Save(IOutputStream* out, const NSc::TValue& v) { + TString json = Base64Encode(v.ToJson()); + ::Save(out, json); +} + +void TSerializer<NSc::TValue>::Load(IInputStream* in, NSc::TValue& v) { + TString json; + ::Load(in, json); + json = Base64Decode(json); + v = NSc::TValue::FromJsonThrow(json); +} diff --git a/library/cpp/scheme/util/utils.h b/library/cpp/scheme/util/utils.h index f7d666f67a..6613215305 100644 --- a/library/cpp/scheme/util/utils.h +++ b/library/cpp/scheme/util/utils.h @@ -1,23 +1,23 @@ -#pragma once - +#pragma once + #include <library/cpp/scheme/scheme.h> - -#include <util/generic/strbuf.h> -#include <util/ysaveload.h> - -namespace NScUtils { - -void CopyField(const NSc::TValue& from, NSc::TValue& to); - -template <typename... Args> -void CopyField(const NSc::TValue& from, NSc::TValue& to, TStringBuf path, Args... args) { - CopyField(from[path], to[path], args...); -} - -} // namespace NScUtils - -template<> -struct TSerializer<NSc::TValue> { - static void Save(IOutputStream* out, const NSc::TValue& v); - static void Load(IInputStream* in, NSc::TValue& v); -}; + +#include <util/generic/strbuf.h> +#include <util/ysaveload.h> + +namespace NScUtils { + +void CopyField(const NSc::TValue& from, NSc::TValue& to); + +template <typename... Args> +void CopyField(const NSc::TValue& from, NSc::TValue& to, TStringBuf path, Args... args) { + CopyField(from[path], to[path], args...); +} + +} // namespace NScUtils + +template<> +struct TSerializer<NSc::TValue> { + static void Save(IOutputStream* out, const NSc::TValue& v); + static void Load(IInputStream* in, NSc::TValue& v); +}; diff --git a/library/cpp/scheme/util/ya.make b/library/cpp/scheme/util/ya.make index dffd1c8070..e2f71e9bfa 100644 --- a/library/cpp/scheme/util/ya.make +++ b/library/cpp/scheme/util/ya.make @@ -1,14 +1,14 @@ -LIBRARY() - -OWNER(g:cards_serivce) - -SRCS( - scheme_holder.cpp - utils.cpp -) - -PEERDIR( +LIBRARY() + +OWNER(g:cards_serivce) + +SRCS( + scheme_holder.cpp + utils.cpp +) + +PEERDIR( library/cpp/string_utils/base64 -) - -END() +) + +END() diff --git a/library/cpp/streams/zc_memory_input/zc_memory_input.h b/library/cpp/streams/zc_memory_input/zc_memory_input.h index c939d8e426..a3b71e8374 100644 --- a/library/cpp/streams/zc_memory_input/zc_memory_input.h +++ b/library/cpp/streams/zc_memory_input/zc_memory_input.h @@ -9,7 +9,7 @@ class TZCMemoryInput: public TMemoryInput { public: TZCMemoryInput() { } - + TZCMemoryInput(const char* dataPtr, size_t size) : TMemoryInput(dataPtr, size) { diff --git a/library/cpp/yson/node/node_io.cpp b/library/cpp/yson/node/node_io.cpp index 294a7f7217..b4ea46f1c0 100644 --- a/library/cpp/yson/node/node_io.cpp +++ b/library/cpp/yson/node/node_io.cpp @@ -79,15 +79,15 @@ static TNode CreateEmptyNodeByType(::NYson::EYsonType type) default: break; } - return result; -} + return result; +} TNode NodeFromYsonString(const TStringBuf input, ::NYson::EYsonType type) -{ +{ TMemoryInput stream(input); return NodeFromYsonStream(&stream, type); } - + TString NodeToYsonString(const TNode& node, NYson::EYsonFormat format) { TStringStream stream; @@ -104,8 +104,8 @@ TString NodeToCanonicalYsonString(const TNode& node, NYson::EYsonFormat format) TNode NodeFromYsonStream(IInputStream* input, ::NYson::EYsonType type) { - TNode result = CreateEmptyNodeByType(type); - + TNode result = CreateEmptyNodeByType(type); + TNodeBuilder builder(&result); ::NYson::TYsonParser parser(&builder, input, type); parser.Parse(); @@ -129,17 +129,17 @@ void NodeToCanonicalYsonStream(const TNode& node, IOutputStream* output, NYson:: TNode NodeFromJsonString(const TStringBuf input) { TMemoryInput stream(input); - + TNode result; - - TNodeBuilder builder(&result); - TYson2JsonCallbacksAdapter callbacks(&builder, /*throwException*/ true); + + TNodeBuilder builder(&result); + TYson2JsonCallbacksAdapter callbacks(&builder, /*throwException*/ true); NJson::TJsonReaderConfig config; config.DontValidateUtf8 = true; NJson::ReadJson(&stream, &config, &callbacks); - return result; -} - + return result; +} + TNode NodeFromJsonValue(const NJson::TJsonValue& input) { TNode result; diff --git a/library/cpp/yson/node/node_io.h b/library/cpp/yson/node/node_io.h index 2ad23b658f..21016ec9e6 100644 --- a/library/cpp/yson/node/node_io.h +++ b/library/cpp/yson/node/node_io.h @@ -34,7 +34,7 @@ TNode NodeFromJsonString(const TStringBuf input); // Convert TJsonValue to TNode TNode NodeFromJsonValue(const NJson::TJsonValue& input); - + //////////////////////////////////////////////////////////////////////////////// } // namespace NYT diff --git a/util/generic/deque.h b/util/generic/deque.h index 2dabaf3177..f08370c2dc 100644 --- a/util/generic/deque.h +++ b/util/generic/deque.h @@ -1,6 +1,6 @@ #pragma once -#include "fwd.h" +#include "fwd.h" #include <util/memory/alloc.h> diff --git a/util/generic/fwd.h b/util/generic/fwd.h index 5cc2da40e5..58d0d2e7fe 100644 --- a/util/generic/fwd.h +++ b/util/generic/fwd.h @@ -51,49 +51,49 @@ class TAvlTree; template <class TValue, class TCmp> class TRbTree; -//containers -template <class T, class A = std::allocator<T>> +//containers +template <class T, class A = std::allocator<T>> class TVector; -template <class T, class A = std::allocator<T>> +template <class T, class A = std::allocator<T>> class TDeque; - + template <class T, class S = TDeque<T>> class TQueue; - + template <class T, class S = TVector<T>, class C = TLess<T>> class TPriorityQueue; - + template <class Key, class T, class HashFcn = THash<Key>, class EqualKey = TEqualTo<Key>, class Alloc = std::allocator<Key>> class THashMap; - + template <class Key, class T, class HashFcn = THash<Key>, class EqualKey = TEqualTo<Key>, class Alloc = std::allocator<Key>> class THashMultiMap; - -template <class Value, class HashFcn = THash<Value>, class EqualKey = TEqualTo<Value>, class Alloc = std::allocator<Value>> + +template <class Value, class HashFcn = THash<Value>, class EqualKey = TEqualTo<Value>, class Alloc = std::allocator<Value>> class THashSet; -template <class Value, class HashFcn = THash<Value>, class EqualKey = TEqualTo<Value>, class Alloc = std::allocator<Value>> +template <class Value, class HashFcn = THash<Value>, class EqualKey = TEqualTo<Value>, class Alloc = std::allocator<Value>> class THashMultiSet; - -template <class T, class A = std::allocator<T>> + +template <class T, class A = std::allocator<T>> class TList; - -template <class K, class V, class Less = TLess<K>, class A = std::allocator<K>> + +template <class K, class V, class Less = TLess<K>, class A = std::allocator<K>> class TMap; - -template <class K, class V, class Less = TLess<K>, class A = std::allocator<K>> + +template <class K, class V, class Less = TLess<K>, class A = std::allocator<K>> class TMultiMap; - -template <class K, class L = TLess<K>, class A = std::allocator<K>> + +template <class K, class L = TLess<K>, class A = std::allocator<K>> class TSet; - -template <class K, class L = TLess<K>, class A = std::allocator<K>> + +template <class K, class L = TLess<K>, class A = std::allocator<K>> class TMultiSet; - + template <class T, class S = TDeque<T>> class TStack; - + template <size_t BitCount, typename TChunkType = ui64> class TBitMap; diff --git a/util/generic/hash.h b/util/generic/hash.h index e46db21fa9..4e5d4dff43 100644 --- a/util/generic/hash.h +++ b/util/generic/hash.h @@ -448,7 +448,7 @@ struct _yhashtable_traits { extern const void* const _yhashtable_empty_data[]; -template <class Value, class Key, class HashFcn, class ExtractKey, class EqualKey, class Alloc> +template <class Value, class Key, class HashFcn, class ExtractKey, class EqualKey, class Alloc> class THashTable: private _yhashtable_traits<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>::base_type { using traits_type = _yhashtable_traits<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>; using base_type = typename traits_type::base_type; @@ -1421,7 +1421,7 @@ namespace NPrivate { [[noreturn]] void ThrowKeyNotFoundInHashTableException(const TStringBuf keyRepresentation); } -template <class Key, class T, class HashFcn, class EqualKey, class Alloc> +template <class Key, class T, class HashFcn, class EqualKey, class Alloc> class THashMap: public TMapOps<THashMap<Key, T, HashFcn, EqualKey, Alloc>> { private: using ht = THashTable<std::pair<const Key, T>, Key, HashFcn, TSelect1st, EqualKey, Alloc>; diff --git a/util/generic/hash_set.h b/util/generic/hash_set.h index e8088cf23b..c80c1059fc 100644 --- a/util/generic/hash_set.h +++ b/util/generic/hash_set.h @@ -8,7 +8,7 @@ #undef value_type -template <class Value, class HashFcn, class EqualKey, class Alloc> +template <class Value, class HashFcn, class EqualKey, class Alloc> class THashSet { private: using ht = THashTable<Value, Value, HashFcn, ::TIdentity, EqualKey, Alloc>; diff --git a/util/generic/list.h b/util/generic/list.h index 7b0b8ffc72..e42a2e9f44 100644 --- a/util/generic/list.h +++ b/util/generic/list.h @@ -9,7 +9,7 @@ #include <memory> #include <utility> -template <class T, class A> +template <class T, class A> class TList: public std::list<T, TReboundAllocator<A, T>> { using TBase = std::list<T, TReboundAllocator<A, T>>; diff --git a/util/generic/map.h b/util/generic/map.h index b5001b56c0..2d9ccdc5e4 100644 --- a/util/generic/map.h +++ b/util/generic/map.h @@ -11,7 +11,7 @@ #include <map> #include <memory> -template <class K, class V, class Less, class A> +template <class K, class V, class Less, class A> class TMap: public std::map<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>>, public TMapOps<TMap<K, V, Less, A>> { using TBase = std::map<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>>; @@ -27,7 +27,7 @@ public: } }; -template <class K, class V, class Less, class A> +template <class K, class V, class Less, class A> class TMultiMap: public std::multimap<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>> { using TBase = std::multimap<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>>; diff --git a/util/generic/set.h b/util/generic/set.h index 4c437ca26f..63b6f34cc4 100644 --- a/util/generic/set.h +++ b/util/generic/set.h @@ -9,7 +9,7 @@ #include <memory> #include <set> -template <class K, class L, class A> +template <class K, class L, class A> class TSet: public std::set<K, L, TReboundAllocator<A, K>> { public: using TBase = std::set<K, L, TReboundAllocator<A, K>>; diff --git a/util/generic/vector.h b/util/generic/vector.h index a5b258955a..32da677ed6 100644 --- a/util/generic/vector.h +++ b/util/generic/vector.h @@ -8,7 +8,7 @@ #include <vector> #include <initializer_list> -template <class T, class A> +template <class T, class A> class TVector: public std::vector<T, TReboundAllocator<A, T>> { public: using TBase = std::vector<T, TReboundAllocator<A, T>>; |