diff options
author | yuraaka <yuraaka@yandex-team.ru> | 2022-02-10 16:47:05 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:05 +0300 |
commit | 5577dc406121f6fb3f45b227c01f4251880193a1 (patch) | |
tree | b83306b6e37edeea782e9eed673d89286c4fef35 /util | |
parent | 4230543261d7a38ef4dc14785ae0d45f2da43704 (diff) | |
download | ydb-5577dc406121f6fb3f45b227c01f4251880193a1.tar.gz |
Restoring authorship annotation for <yuraaka@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/datetime/parser.rl6 | 2 | ||||
-rw-r--r-- | util/generic/maybe.h | 6 | ||||
-rw-r--r-- | util/generic/maybe_ut.cpp | 24 | ||||
-rw-r--r-- | util/generic/ptr.h | 6 | ||||
-rw-r--r-- | util/generic/typetraits.h | 30 | ||||
-rw-r--r-- | util/generic/typetraits_ut.cpp | 10 | ||||
-rw-r--r-- | util/generic/vector.h | 10 | ||||
-rw-r--r-- | util/string/builder.h | 12 | ||||
-rw-r--r-- | util/system/info.cpp | 4 | ||||
-rw-r--r-- | util/thread/pool.h | 2 |
10 files changed, 53 insertions, 53 deletions
diff --git a/util/datetime/parser.rl6 b/util/datetime/parser.rl6 index 05509d4356..931f09eae1 100644 --- a/util/datetime/parser.rl6 +++ b/util/datetime/parser.rl6 @@ -729,7 +729,7 @@ include DateTimeParserCommon; multiplier = '' # >{ MultiplierPower = 6; } # work around Ragel bugs - | 'w' @{ MultiplierPower = 6; Multiplier = 604800; } + | 'w' @{ MultiplierPower = 6; Multiplier = 604800; } | 'd' @{ MultiplierPower = 6; Multiplier = 86400; } | 'h' @{ MultiplierPower = 6; Multiplier = 3600; } | 'm' @{ MultiplierPower = 6; Multiplier = 60; } diff --git a/util/generic/maybe.h b/util/generic/maybe.h index 2066f6bb7b..34d21aebcd 100644 --- a/util/generic/maybe.h +++ b/util/generic/maybe.h @@ -377,11 +377,11 @@ public: return Defined() ? *this : elseValue; } - template <typename U> + template <typename U> TMaybe<U, Policy> Cast() const { return Defined() ? TMaybe<U, Policy>(*Data()) : TMaybe<U, Policy>(); - } - + } + constexpr explicit operator bool() const noexcept { return Defined(); } diff --git a/util/generic/maybe_ut.cpp b/util/generic/maybe_ut.cpp index 289824521a..2c1a425c5e 100644 --- a/util/generic/maybe_ut.cpp +++ b/util/generic/maybe_ut.cpp @@ -208,19 +208,19 @@ Y_UNIT_TEST_SUITE(TMaybeTest) { TMovable o6 = MakeMaybe<TMovable>(6).GetRef(); UNIT_ASSERT_VALUES_EQUAL(o6.Flag, 6); } - + Y_UNIT_TEST(TestCast) { - // Undefined maybe casts to undefined maybe - TMaybe<short> shortMaybe; - const auto undefinedMaybe = shortMaybe.Cast<long>(); - UNIT_ASSERT(!undefinedMaybe.Defined()); - - // Defined maybe casts to defined maybe of another type - shortMaybe = 34; - const auto longMaybe = shortMaybe.Cast<long>(); - UNIT_ASSERT(longMaybe.Defined()); - UNIT_ASSERT_VALUES_EQUAL(34, longMaybe.GetRef()); - } + // Undefined maybe casts to undefined maybe + TMaybe<short> shortMaybe; + const auto undefinedMaybe = shortMaybe.Cast<long>(); + UNIT_ASSERT(!undefinedMaybe.Defined()); + + // Defined maybe casts to defined maybe of another type + shortMaybe = 34; + const auto longMaybe = shortMaybe.Cast<long>(); + UNIT_ASSERT(longMaybe.Defined()); + UNIT_ASSERT_VALUES_EQUAL(34, longMaybe.GetRef()); + } Y_UNIT_TEST(TestGetOr) { UNIT_ASSERT_VALUES_EQUAL(TMaybe<TString>().GetOrElse("xxx"), TString("xxx")); diff --git a/util/generic/ptr.h b/util/generic/ptr.h index 4d652175d2..19db0e3ec5 100644 --- a/util/generic/ptr.h +++ b/util/generic/ptr.h @@ -818,9 +818,9 @@ public: template <class TT, class = TGuardConversion<T, TT>> inline TSharedPtr(THolder<TT>&& t) { - Init(t); - } - + Init(t); + } + inline ~TSharedPtr() { UnRef(); } diff --git a/util/generic/typetraits.h b/util/generic/typetraits.h index 9cb9527a8d..d165bd1a06 100644 --- a/util/generic/typetraits.h +++ b/util/generic/typetraits.h @@ -4,7 +4,7 @@ #include <util/system/defaults.h> -#include <iterator> +#include <iterator> #include <type_traits> #include <stlfwd> @@ -300,21 +300,21 @@ using TEnableIfTuple = std::enable_if_t<::TDisjunction<::TIsSpecializationOf<std ::TIsSpecializationOf<std::pair, std::decay_t<T>>>::value, R>; -namespace NPrivate { - // To allow ADL with custom begin/end - using std::begin; - using std::end; - - template <typename T> +namespace NPrivate { + // To allow ADL with custom begin/end + using std::begin; + using std::end; + + template <typename T> auto IsIterableImpl(int) -> decltype( begin(std::declval<T&>()) != end(std::declval<T&>()), // begin/end and operator != - ++std::declval<decltype(begin(std::declval<T&>()))&>(), // operator ++ + ++std::declval<decltype(begin(std::declval<T&>()))&>(), // operator ++ *begin(std::declval<T&>()), // operator* std::true_type{}); - - template <typename T> - std::false_type IsIterableImpl(...); -} - -template <typename T> -using TIsIterable = decltype(NPrivate::IsIterableImpl<T>(0)); + + template <typename T> + std::false_type IsIterableImpl(...); +} + +template <typename T> +using TIsIterable = decltype(NPrivate::IsIterableImpl<T>(0)); diff --git a/util/generic/typetraits_ut.cpp b/util/generic/typetraits_ut.cpp index 4de0c5377f..e7571c75ec 100644 --- a/util/generic/typetraits_ut.cpp +++ b/util/generic/typetraits_ut.cpp @@ -456,11 +456,11 @@ static_assert(TIsSpecializationOf<std::vector, std::vector<int>>::value, ""); static_assert(TIsSpecializationOf<std::tuple, std::tuple<int, double, char>>::value, ""); static_assert(!TIsSpecializationOf<std::vector, std::tuple<int, double, char>>::value, ""); static_assert(!TIsSpecializationOf<std::pair, std::vector<int>>::value, ""); - -// test for TIsIterable -static_assert(TIsIterable<std::vector<int>>::value, ""); -static_assert(!TIsIterable<int>::value, ""); -static_assert(TIsIterable<int[42]>::value, ""); + +// test for TIsIterable +static_assert(TIsIterable<std::vector<int>>::value, ""); +static_assert(!TIsIterable<int>::value, ""); +static_assert(TIsIterable<int[42]>::value, ""); // test for TDependentFalse static_assert(TDependentFalse<int> == false); diff --git a/util/generic/vector.h b/util/generic/vector.h index d4ac69180d..a5b258955a 100644 --- a/util/generic/vector.h +++ b/util/generic/vector.h @@ -42,11 +42,11 @@ public: { } - inline explicit TVector(size_type count, const typename TBase::allocator_type& a) - : TBase(count, a) - { - } - + inline explicit TVector(size_type count, const typename TBase::allocator_type& a) + : TBase(count, a) + { + } + inline TVector(size_type count, const T& val) : TBase(count, val) { diff --git a/util/string/builder.h b/util/string/builder.h index 1517e79ac0..7b54821151 100644 --- a/util/string/builder.h +++ b/util/string/builder.h @@ -12,12 +12,12 @@ namespace NPrivateStringBuilder { { } - TStringBuilder(TStringBuilder&& rhs) - : TString(std::move(rhs)) - , Out(*this) - { - } - + TStringBuilder(TStringBuilder&& rhs) + : TString(std::move(rhs)) + , Out(*this) + { + } + TStringOutput Out; }; diff --git a/util/system/info.cpp b/util/system/info.cpp index 4fd28c28cc..cf6681e89a 100644 --- a/util/system/info.cpp +++ b/util/system/info.cpp @@ -75,8 +75,8 @@ size_t NSystemInfo::NumberOfCpus() { GetSystemInfo(&info); return info.dwNumberOfProcessors; -#elif defined(_SC_NPROCESSORS_ONLN) - return sysconf(_SC_NPROCESSORS_ONLN); +#elif defined(_SC_NPROCESSORS_ONLN) + return sysconf(_SC_NPROCESSORS_ONLN); #elif defined(_linux_) unsigned ret; int fd, nread, column; diff --git a/util/thread/pool.h b/util/thread/pool.h index 1db151be8e..d1ea3a67cb 100644 --- a/util/thread/pool.h +++ b/util/thread/pool.h @@ -304,7 +304,7 @@ public: bool Add(IObjectInQueue* obj) override Y_WARN_UNUSED_RESULT; /** @param thrnum, @param maxque are ignored */ - void Start(size_t thrnum = 0, size_t maxque = 0) override; + void Start(size_t thrnum = 0, size_t maxque = 0) override; void Stop() noexcept override; size_t Size() const noexcept override; |