diff options
author | spacelord <spacelord@yandex-team.ru> | 2022-02-10 16:48:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:15 +0300 |
commit | a0c6d9ad0cf6b94c527a15da147eb24335281b6d (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /util | |
parent | 16747e4f77455cca4932df21eb76f12cb0a97a5c (diff) | |
download | ydb-a0c6d9ad0cf6b94c527a15da147eb24335281b6d.tar.gz |
Restoring authorship annotation for <spacelord@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
86 files changed, 603 insertions, 603 deletions
diff --git a/util/charset/unicode_table.h b/util/charset/unicode_table.h index 0918802908..9e171b2583 100644 --- a/util/charset/unicode_table.h +++ b/util/charset/unicode_table.h @@ -10,9 +10,9 @@ namespace NUnicodeTable { template <class Value> struct TValueSelector { - using TStored = const Value; - using TValueRef = const Value&; - using TValuePtr = const Value*; + using TStored = const Value; + using TValueRef = const Value&; + using TValuePtr = const Value*; static inline TValueRef Get(TValuePtr val) { return *val; @@ -21,9 +21,9 @@ namespace NUnicodeTable { template <class Value> struct TValueSelector<const Value*> { - using TStored = const Value[]; - using TValueRef = const Value*; - using TValuePtr = const Value*; + using TStored = const Value[]; + using TValueRef = const Value*; + using TValuePtr = const Value*; static inline TValueRef Get(TValuePtr val) { return val; @@ -32,13 +32,13 @@ namespace NUnicodeTable { template <class Value> struct TValues { - using TSelector = TValueSelector<Value>; + using TSelector = TValueSelector<Value>; - using TStored = typename TSelector::TStored; - using TValueRef = typename TSelector::TValueRef; - using TValuePtr = typename TSelector::TValuePtr; + using TStored = typename TSelector::TStored; + using TValueRef = typename TSelector::TValueRef; + using TValuePtr = typename TSelector::TValuePtr; - using TData = const TValuePtr*; + using TData = const TValuePtr*; static inline TValuePtr Get(TData table, size_t index) { static_assert(std::is_pointer<TData>::value, "expect std::is_pointer<TData>::value"); @@ -52,10 +52,10 @@ namespace NUnicodeTable { template <int Shift, class TChild> struct TSubtable { - using TStored = typename TChild::TStored; - using TValueRef = typename TChild::TValueRef; - using TValuePtr = typename TChild::TValuePtr; - using TData = const typename TChild::TData*; + using TStored = typename TChild::TStored; + using TValueRef = typename TChild::TValueRef; + using TValuePtr = typename TChild::TValuePtr; + using TData = const typename TChild::TData*; static inline TValuePtr Get(TData table, size_t key) { static_assert(std::is_pointer<TData>::value, "expect std::is_pointer<TData>::value"); @@ -70,16 +70,16 @@ namespace NUnicodeTable { template <class T> class TTable { private: - using TImpl = T; - using TData = typename TImpl::TData; + using TImpl = T; + using TData = typename TImpl::TData; const TData Data; const size_t MSize; public: - using TStored = typename TImpl::TStored; - using TValueRef = typename TImpl::TValueRef; - using TValuePtr = typename TImpl::TValuePtr; + using TStored = typename TImpl::TStored; + using TValueRef = typename TImpl::TValueRef; + using TValuePtr = typename TImpl::TValuePtr; private: inline TValueRef GetImpl(size_t key) const { diff --git a/util/charset/unidata.h b/util/charset/unidata.h index 1323635ac4..400d314186 100644 --- a/util/charset/unidata.h +++ b/util/charset/unidata.h @@ -99,7 +99,7 @@ const size_t DEFCHAR_BUF = 58; // CCL_NUM + 1 #define SHIFT(i) (ULL(1) << (i)) namespace NUnicode { - using TCombining = ui8; + using TCombining = ui8; namespace NPrivate { struct TProperty { @@ -112,7 +112,7 @@ namespace NUnicode { extern const size_t DEFAULT_KEY; - using TUnidataTable = NUnicodeTable::TTable<NUnicodeTable::TSubtable<NUnicodeTable::UNICODE_TABLE_SHIFT, NUnicodeTable::TValues<TProperty>>>; + using TUnidataTable = NUnicodeTable::TTable<NUnicodeTable::TSubtable<NUnicodeTable::UNICODE_TABLE_SHIFT, NUnicodeTable::TValues<TProperty>>>; const TUnidataTable& UnidataTable(); inline const TProperty& CharProperty(wchar32 ch) { diff --git a/util/datetime/base.h b/util/datetime/base.h index 9746cc9d1c..5e902b8f63 100644 --- a/util/datetime/base.h +++ b/util/datetime/base.h @@ -96,7 +96,7 @@ TString YearToString(time_t when); template <class S> class TTimeBase { public: - using TValue = ui64; + using TValue = ui64; protected: constexpr TTimeBase(const TValue& value) noexcept @@ -178,22 +178,22 @@ protected: namespace NDateTimeHelpers { template <typename T> struct TPrecisionHelper { - using THighPrecision = ui64; + using THighPrecision = ui64; }; template <> struct TPrecisionHelper<float> { - using THighPrecision = double; + using THighPrecision = double; }; template <> struct TPrecisionHelper<double> { - using THighPrecision = double; + using THighPrecision = double; }; } class TDuration: public TTimeBase<TDuration> { - using TBase = TTimeBase<TDuration>; + using TBase = TTimeBase<TDuration>; private: /** @@ -348,7 +348,7 @@ struct THash<TDuration> { /// TInstant and TDuration are guaranteed to have same precision class TInstant: public TTimeBase<TInstant> { - using TBase = TTimeBase<TInstant>; + using TBase = TTimeBase<TInstant>; private: /** @@ -411,11 +411,11 @@ public: return Seconds(m * 60); } - /// hours since epoch + /// hours since epoch static constexpr TInstant Hours(ui64 h) noexcept { - return Minutes(h * 60); - } - + return Minutes(h * 60); + } + /// days since epoch static constexpr TInstant Days(ui64 d) noexcept { return Hours(d * 24); diff --git a/util/datetime/base_ut.cpp b/util/datetime/base_ut.cpp index d7fef849db..afc3f802eb 100644 --- a/util/datetime/base_ut.cpp +++ b/util/datetime/base_ut.cpp @@ -447,7 +447,7 @@ Y_UNIT_TEST_SUITE(DateTimeTest) { // division UNIT_ASSERT_DOUBLES_EQUAL(TDuration::Minutes(1) / TDuration::Seconds(10), 6.0, 1e-9); } - + Y_UNIT_TEST(TestDurationGetters) { const TDuration value = TDuration::MicroSeconds(1234567); UNIT_ASSERT_VALUES_EQUAL(value.Seconds(), 1); @@ -466,23 +466,23 @@ Y_UNIT_TEST_SUITE(DateTimeTest) { T onlyHours = T::MicroSeconds(1249570800000000L); T onlyDays = T::MicroSeconds(1249516800000000L); ui64 minutes = 20826199; - ui64 hours = 347103; + ui64 hours = 347103; ui64 days = 14462; UNIT_ASSERT_VALUES_EQUAL(withTime.Minutes(), minutes); UNIT_ASSERT_VALUES_EQUAL(onlyMinutes, T::Minutes(minutes)); UNIT_ASSERT_VALUES_EQUAL(onlyMinutes.Minutes(), minutes); - UNIT_ASSERT_VALUES_EQUAL(withTime.Hours(), hours); + UNIT_ASSERT_VALUES_EQUAL(withTime.Hours(), hours); UNIT_ASSERT_VALUES_EQUAL(onlyMinutes.Hours(), hours); UNIT_ASSERT_VALUES_EQUAL(onlyHours, T::Hours(hours)); - UNIT_ASSERT_VALUES_EQUAL(onlyHours.Hours(), hours); + UNIT_ASSERT_VALUES_EQUAL(onlyHours.Hours(), hours); UNIT_ASSERT_VALUES_EQUAL(withTime.Days(), days); UNIT_ASSERT_VALUES_EQUAL(onlyHours.Days(), days); UNIT_ASSERT_VALUES_EQUAL(onlyDays, T::Days(days)); UNIT_ASSERT_VALUES_EQUAL(onlyDays.Days(), days); - } + } Y_UNIT_TEST(TestInstantUnits) { TestTimeUnits<TInstant>(); diff --git a/util/digest/city.cpp b/util/digest/city.cpp index 4a2946360d..c25f175d54 100644 --- a/util/digest/city.cpp +++ b/util/digest/city.cpp @@ -31,9 +31,9 @@ #include "city.h" -using uint8 = ui8; -using uint32 = ui32; -using uint64 = ui64; +using uint8 = ui8; +using uint32 = ui32; +using uint64 = ui64; #include <util/system/unaligned_mem.h> #include <util/generic/algorithm.h> diff --git a/util/draft/holder_vector.h b/util/draft/holder_vector.h index f190b8ac94..1c62055bd9 100644 --- a/util/draft/holder_vector.h +++ b/util/draft/holder_vector.h @@ -87,7 +87,7 @@ public: using TBase::at; using TBase::back; using TBase::begin; - using TBase::capacity; + using TBase::capacity; using TBase::empty; using TBase::end; using TBase::front; diff --git a/util/draft/ip.h b/util/draft/ip.h index ea72457f47..eb947cd2cd 100644 --- a/util/draft/ip.h +++ b/util/draft/ip.h @@ -21,7 +21,7 @@ #endif // Network (big-endian) byte order -using TIp4 = TIpHost; +using TIp4 = TIpHost; // Network (big-endian) byte order struct TIp6 { diff --git a/util/folder/dirut.cpp b/util/folder/dirut.cpp index 72cb802a9c..ffc9b09f96 100644 --- a/util/folder/dirut.cpp +++ b/util/folder/dirut.cpp @@ -124,13 +124,13 @@ bool resolvepath(TString& folder, const TString& home) { #else -using dir_type = enum { - dt_empty, - dt_error, - dt_up, - dt_dir -}; - +using dir_type = enum { + dt_empty, + dt_error, + dt_up, + dt_dir +}; + // precondition: *ptr != '\\' || *ptr == 0 (cause dt_error) // postcondition: *ptr != '\\' template <typename T> @@ -181,14 +181,14 @@ static int next_dir(T*& ptr) { return dt_error; } -using disk_type = enum { - dk_noflags = 0, - dk_unc = 1, - dk_hasdrive = 2, - dk_fromroot = 4, - dk_error = 8 -}; - +using disk_type = enum { + dk_noflags = 0, + dk_unc = 1, + dk_hasdrive = 2, + dk_fromroot = 4, + dk_error = 8 +}; + // root slash (if any) - part of disk template <typename T> static int skip_disk(T*& ptr) { diff --git a/util/folder/iterator.h b/util/folder/iterator.h index 3463d87b50..69e025b9c4 100644 --- a/util/folder/iterator.h +++ b/util/folder/iterator.h @@ -25,7 +25,7 @@ public: } }; - using TCompare = int (*)(const FTSENT**, const FTSENT**); + using TCompare = int (*)(const FTSENT**, const FTSENT**); struct TOptions { inline TOptions() { diff --git a/util/folder/path.cpp b/util/folder/path.cpp index 02e9883171..bfe0c67d68 100644 --- a/util/folder/path.cpp +++ b/util/folder/path.cpp @@ -164,8 +164,8 @@ TString TFsPath::GetName() const { TString TFsPath::GetExtension() const { return TString(GetSplit().Extension()); -} - +} + bool TFsPath::IsAbsolute() const { return GetSplit().IsAbsolute; } diff --git a/util/folder/path.h b/util/folder/path.h index e2ccac8775..2fb4d6b4ef 100644 --- a/util/folder/path.h +++ b/util/folder/path.h @@ -78,13 +78,13 @@ public: /// last component of path, or "/" if root TString GetName() const; - /** - * "a.b.tmp" -> "tmp" - * "a.tmp" -> "tmp" - * ".tmp" -> "" - */ + /** + * "a.b.tmp" -> "tmp" + * "a.tmp" -> "tmp" + * ".tmp" -> "" + */ TString GetExtension() const; - + bool IsAbsolute() const; bool IsRelative() const; diff --git a/util/folder/path_ut.cpp b/util/folder/path_ut.cpp index d79b8da97c..e6a3451016 100644 --- a/util/folder/path_ut.cpp +++ b/util/folder/path_ut.cpp @@ -137,7 +137,7 @@ Y_UNIT_TEST_SUITE(TFsPathTests) { UNIT_ASSERT_VALUES_EQUAL("zlib", d.Child("file.zlib").GetExtension()); UNIT_ASSERT_VALUES_EQUAL("zlib", d.Child("file.ylib.zlib").GetExtension()); } - + Y_UNIT_TEST(TestRename) { TTestDirectory xx("TestRename"); TFsPath f1 = xx.Child("f1"); diff --git a/util/folder/pathsplit.cpp b/util/folder/pathsplit.cpp index 7c6414749e..81d439a727 100644 --- a/util/folder/pathsplit.cpp +++ b/util/folder/pathsplit.cpp @@ -118,9 +118,9 @@ void TPathSplitStore::AppendComponent(const TStringBuf comp) { } TStringBuf TPathSplitStore::Extension() const { - return size() > 0 ? CutExtension(back()) : TStringBuf(); -} - + return size() > 0 ? CutExtension(back()) : TStringBuf(); +} + template <> void Out<TPathSplit>(IOutputStream& o, const TPathSplit& ps) { o << ps.Reconstruct(); @@ -133,19 +133,19 @@ TString JoinPaths(const TPathSplit& p1, const TPathSplit& p2) { return TPathSplit(p1).AppendMany(p2.begin(), p2.end()).Reconstruct(); } - + TStringBuf CutExtension(const TStringBuf fileName) { if (fileName.empty()) { - return fileName; - } - - TStringBuf name; - TStringBuf extension; - fileName.RSplit('.', name, extension); + return fileName; + } + + TStringBuf name; + TStringBuf extension; + fileName.RSplit('.', name, extension); if (name.empty()) { - // dot at a start or not found - return name; - } else { - return extension; - } -} + // dot at a start or not found + return name; + } else { + return extension; + } +} diff --git a/util/folder/pathsplit.h b/util/folder/pathsplit.h index d40e81b0d1..d134338e35 100644 --- a/util/folder/pathsplit.h +++ b/util/folder/pathsplit.h @@ -91,7 +91,7 @@ public: return *this; } - + template <class It> inline TPathSplitBase& AppendMany(It b, It e) { this->AppendHint(e - b); @@ -109,5 +109,5 @@ using TPathSplitUnix = TPathSplitBase<TPathSplitTraitsUnix>; using TPathSplitWindows = TPathSplitBase<TPathSplitTraitsWindows>; TString JoinPaths(const TPathSplit& p1, const TPathSplit& p2); - + TStringBuf CutExtension(const TStringBuf fileName); diff --git a/util/generic/bitmap.h b/util/generic/bitmap.h index 8f7d3f2aa4..f77d182460 100644 --- a/util/generic/bitmap.h +++ b/util/generic/bitmap.h @@ -152,7 +152,7 @@ namespace NBitMapPrivate { template <size_t BitCount, typename TChunkType> struct TFixedStorage { - using TChunk = TChunkType; + using TChunk = TChunkType; static constexpr size_t Size = (BitCount + 8 * sizeof(TChunk) - 1) / (8 * sizeof(TChunk)); @@ -202,7 +202,7 @@ namespace NBitMapPrivate { // It uses "on stack" realization with no allocation for one chunk spaces template <typename TChunkType> struct TDynamicStorage { - using TChunk = TChunkType; + using TChunk = TChunkType; size_t Size; TChunk StackData; @@ -298,21 +298,21 @@ namespace NBitMapPrivate { template <size_t BitCount, typename TChunkType> struct TFixedBitMapTraits { - using TChunk = TChunkType; - using TStorage = NBitMapPrivate::TFixedStorage<BitCount, TChunkType>; + using TChunk = TChunkType; + using TStorage = NBitMapPrivate::TFixedStorage<BitCount, TChunkType>; }; template <typename TChunkType> struct TDynamicBitMapTraits { - using TChunk = TChunkType; - using TStorage = NBitMapPrivate::TDynamicStorage<TChunkType>; + using TChunk = TChunkType; + using TStorage = NBitMapPrivate::TDynamicStorage<TChunkType>; }; template <class TTraits> class TBitMapOps { public: - using TChunk = typename TTraits::TChunk; - using TThis = TBitMapOps<TTraits>; + using TChunk = typename TTraits::TChunk; + using TThis = TBitMapOps<TTraits>; private: static_assert(std::is_unsigned<TChunk>::value, "expect std::is_unsigned<TChunk>::value"); @@ -325,7 +325,7 @@ private: template <class> friend class TBitMapOps; - using TStorage = typename TTraits::TStorage; + using TStorage = typename TTraits::TStorage; // The smallest unsigned type, which can be used in bit ops using TIntType = std::conditional_t<sizeof(TChunk) < sizeof(unsigned int), unsigned int, TChunk>; @@ -1080,7 +1080,7 @@ inline TBitMapOps<X> operator~(const TBitMapOps<X>& x) { template <size_t BitCount, typename TChunkType /*= ui64*/> class TBitMap: public TBitMapOps<TFixedBitMapTraits<BitCount, TChunkType>> { private: - using TBase = TBitMapOps<TFixedBitMapTraits<BitCount, TChunkType>>; + using TBase = TBitMapOps<TFixedBitMapTraits<BitCount, TChunkType>>; public: TBitMap() @@ -1102,7 +1102,7 @@ public: } }; -using TDynBitMap = TBitMapOps<TDynamicBitMapTraits<ui64>>; +using TDynBitMap = TBitMapOps<TDynamicBitMapTraits<ui64>>; #define Y_FOR_EACH_BIT(var, bitmap) for (size_t var = (bitmap).FirstNonZeroBit(); var != (bitmap).Size(); var = (bitmap).NextNonZeroBit(var)) diff --git a/util/generic/bitmap_ut.cpp b/util/generic/bitmap_ut.cpp index 2d4751e660..087d34a8dc 100644 --- a/util/generic/bitmap_ut.cpp +++ b/util/generic/bitmap_ut.cpp @@ -551,21 +551,21 @@ Y_UNIT_TEST_SUITE(TBitMapTest) { Y_UNIT_TEST(TestSetResetRange) { // Single chunk - using TBitMap1Chunk = TBitMap<64>; + using TBitMap1Chunk = TBitMap<64>; UNIT_ASSERT_EQUAL(TBitMap1Chunk().Flip().Reset(10, 50), TBitMap1Chunk().Set(0, 10).Set(50, 64)); UNIT_ASSERT_EQUAL(TBitMap1Chunk().Flip().Reset(0, 10), TBitMap1Chunk().Set(10, 64)); UNIT_ASSERT_EQUAL(TBitMap1Chunk().Flip().Reset(50, 64), TBitMap1Chunk().Set(0, 50)); UNIT_ASSERT_EQUAL(TBitMap1Chunk().Flip().Reset(0, 10).Reset(50, 64), TBitMap1Chunk().Set(10, 50)); // Two chunks - using TBitMap2Chunks = TBitMap<64, ui32>; + using TBitMap2Chunks = TBitMap<64, ui32>; UNIT_ASSERT_EQUAL(TBitMap2Chunks().Flip().Reset(10, 50), TBitMap2Chunks().Set(0, 10).Set(50, 64)); UNIT_ASSERT_EQUAL(TBitMap2Chunks().Flip().Reset(0, 10), TBitMap2Chunks().Set(10, 64)); UNIT_ASSERT_EQUAL(TBitMap2Chunks().Flip().Reset(50, 64), TBitMap2Chunks().Set(0, 50)); UNIT_ASSERT_EQUAL(TBitMap2Chunks().Flip().Reset(0, 10).Reset(50, 64), TBitMap2Chunks().Set(10, 50)); // Many chunks - using TBitMap4Chunks = TBitMap<64, ui16>; + using TBitMap4Chunks = TBitMap<64, ui16>; UNIT_ASSERT_EQUAL(TBitMap4Chunks().Flip().Reset(10, 50), TBitMap4Chunks().Set(0, 10).Set(50, 64)); UNIT_ASSERT_EQUAL(TBitMap4Chunks().Flip().Reset(0, 10), TBitMap4Chunks().Set(10, 64)); UNIT_ASSERT_EQUAL(TBitMap4Chunks().Flip().Reset(50, 64), TBitMap4Chunks().Set(0, 50)); diff --git a/util/generic/buffer.h b/util/generic/buffer.h index 800a556633..9576467404 100644 --- a/util/generic/buffer.h +++ b/util/generic/buffer.h @@ -10,8 +10,8 @@ class TBuffer { public: - using TIterator = char*; - using TConstIterator = const char*; + using TIterator = char*; + using TConstIterator = const char*; TBuffer(size_t len = 0); TBuffer(const char* buf, size_t len); diff --git a/util/generic/hash.h b/util/generic/hash.h index 77eef28ffa..e46db21fa9 100644 --- a/util/generic/hash.h +++ b/util/generic/hash.h @@ -65,11 +65,11 @@ struct __yhashtable_iterator { using node = __yhashtable_node<Value>; using iterator_category = std::forward_iterator_tag; - using value_type = Value; - using difference_type = ptrdiff_t; - using size_type = size_t; - using reference = Value&; - using pointer = Value*; + using value_type = Value; + using difference_type = ptrdiff_t; + using size_type = size_t; + using reference = Value&; + using pointer = Value*; node* cur; @@ -108,11 +108,11 @@ struct __yhashtable_const_iterator { using node = __yhashtable_node<Value>; using iterator_category = std::forward_iterator_tag; - using value_type = Value; - using difference_type = ptrdiff_t; - using size_type = size_t; - using reference = const Value&; - using pointer = const Value*; + using value_type = Value; + using difference_type = ptrdiff_t; + using size_type = size_t; + using reference = const Value&; + using pointer = const Value*; const node* cur; @@ -204,21 +204,21 @@ public: */ template <class T, class Alloc> class _yhashtable_buckets: private _allocator_base<Alloc> { - using base_type = _allocator_base<Alloc>; + using base_type = _allocator_base<Alloc>; static_assert(sizeof(T) == sizeof(size_t), "T is expected to be the same size as size_t."); public: - using allocator_type = Alloc; - using value_type = T; - using pointer = T*; - using const_pointer = const T*; - using reference = T&; - using const_reference = const T&; - using iterator = pointer; - using const_iterator = const_pointer; - using size_type = size_t; - using difference_type = ptrdiff_t; + using allocator_type = Alloc; + using value_type = T; + using pointer = T*; + using const_pointer = const T*; + using reference = T&; + using const_reference = const T&; + using iterator = pointer; + using const_iterator = const_pointer; + using size_type = size_t; + using difference_type = ptrdiff_t; using TBucketDivisor = ::NPrivate::THashDivisor; _yhashtable_buckets(const Alloc& other) @@ -349,7 +349,7 @@ private: */ template <class HashFcn, class ExtractKey, class EqualKey, class Alloc, bool IsEmpty = std::is_empty<HashFcn>::value&& std::is_empty<ExtractKey>::value&& std::is_empty<EqualKey>::value> class _yhashtable_base: public _allocator_base<Alloc> { - using base_type = _allocator_base<Alloc>; + using base_type = _allocator_base<Alloc>; public: _yhashtable_base(const HashFcn& hash, const ExtractKey& extract, const EqualKey& equals, const Alloc& alloc) @@ -405,7 +405,7 @@ private: template <class HashFcn, class ExtractKey, class EqualKey, class Alloc> class _yhashtable_base<HashFcn, ExtractKey, EqualKey, Alloc, true>: public _allocator_base<Alloc> { - using base_type = _allocator_base<Alloc>; + using base_type = _allocator_base<Alloc>; public: _yhashtable_base(const HashFcn&, const ExtractKey&, const EqualKey&, const Alloc& alloc) @@ -451,27 +451,27 @@ extern const void* const _yhashtable_empty_data[]; 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; - using node = typename traits_type::node; - using nodep_allocator_type = typename traits_type::nodep_allocator_type; + using base_type = typename traits_type::base_type; + using node = typename traits_type::node; + using nodep_allocator_type = typename traits_type::nodep_allocator_type; using buckets_type = _yhashtable_buckets<node*, nodep_allocator_type>; using TBucketDivisor = ::NPrivate::THashDivisor; public: - using key_type = Key; - using value_type = Value; - using hasher = HashFcn; - using key_equal = EqualKey; - using key_extract = ExtractKey; + using key_type = Key; + using value_type = Value; + using hasher = HashFcn; + using key_equal = EqualKey; + using key_extract = ExtractKey; using allocator_type = Alloc; - using node_allocator_type = typename traits_type::node_allocator_type; + using node_allocator_type = typename traits_type::node_allocator_type; - using size_type = size_t; - using difference_type = ptrdiff_t; - using pointer = value_type*; - using const_pointer = const value_type*; - using reference = value_type&; - using const_reference = const value_type&; + using size_type = size_t; + using difference_type = ptrdiff_t; + using pointer = value_type*; + using const_pointer = const value_type*; + using reference = value_type&; + using const_reference = const value_type&; node_allocator_type& GetNodeAllocator() { return this->_get_alloc(); @@ -513,7 +513,7 @@ private: public: using iterator = __yhashtable_iterator<Value>; using const_iterator = __yhashtable_const_iterator<Value>; - using insert_ctx = node**; + using insert_ctx = node**; friend struct __yhashtable_iterator<Value>; friend struct __yhashtable_const_iterator<Value>; @@ -1428,24 +1428,24 @@ private: ht rep; public: - using key_type = typename ht::key_type; - using value_type = typename ht::value_type; - using hasher = typename ht::hasher; - using key_equal = typename ht::key_equal; + using key_type = typename ht::key_type; + using value_type = typename ht::value_type; + using hasher = typename ht::hasher; + using key_equal = typename ht::key_equal; using allocator_type = typename ht::allocator_type; - using node_allocator_type = typename ht::node_allocator_type; - using mapped_type = T; - - using size_type = typename ht::size_type; - using difference_type = typename ht::difference_type; - using pointer = typename ht::pointer; - using const_pointer = typename ht::const_pointer; - using reference = typename ht::reference; - using const_reference = typename ht::const_reference; - - using iterator = typename ht::iterator; - using const_iterator = typename ht::const_iterator; - using insert_ctx = typename ht::insert_ctx; + using node_allocator_type = typename ht::node_allocator_type; + using mapped_type = T; + + using size_type = typename ht::size_type; + using difference_type = typename ht::difference_type; + using pointer = typename ht::pointer; + using const_pointer = typename ht::const_pointer; + using reference = typename ht::reference; + using const_reference = typename ht::const_reference; + + using iterator = typename ht::iterator; + using const_iterator = typename ht::const_iterator; + using insert_ctx = typename ht::insert_ctx; hasher hash_function() const { return rep.hash_function(); @@ -1760,22 +1760,22 @@ private: ht rep; public: - using key_type = typename ht::key_type; - using value_type = typename ht::value_type; - using hasher = typename ht::hasher; - using key_equal = typename ht::key_equal; - using mapped_type = T; + using key_type = typename ht::key_type; + using value_type = typename ht::value_type; + using hasher = typename ht::hasher; + using key_equal = typename ht::key_equal; + using mapped_type = T; using allocator_type = typename ht::allocator_type; - using size_type = typename ht::size_type; - using difference_type = typename ht::difference_type; - using pointer = typename ht::pointer; - using const_pointer = typename ht::const_pointer; - using reference = typename ht::reference; - using const_reference = typename ht::const_reference; + using size_type = typename ht::size_type; + using difference_type = typename ht::difference_type; + using pointer = typename ht::pointer; + using const_pointer = typename ht::const_pointer; + using reference = typename ht::reference; + using const_reference = typename ht::const_reference; - using iterator = typename ht::iterator; - using const_iterator = typename ht::const_iterator; + using iterator = typename ht::iterator; + using const_iterator = typename ht::const_iterator; using insert_ctx = typename ht::insert_ctx; hasher hash_function() const { diff --git a/util/generic/hash_set.h b/util/generic/hash_set.h index c35c7ceaef..e8088cf23b 100644 --- a/util/generic/hash_set.h +++ b/util/generic/hash_set.h @@ -14,26 +14,26 @@ private: using ht = THashTable<Value, Value, HashFcn, ::TIdentity, EqualKey, Alloc>; ht rep; - using mutable_iterator = typename ht::iterator; + using mutable_iterator = typename ht::iterator; public: - using key_type = typename ht::key_type; - using value_type = typename ht::value_type; - using hasher = typename ht::hasher; - using key_equal = typename ht::key_equal; + using key_type = typename ht::key_type; + using value_type = typename ht::value_type; + using hasher = typename ht::hasher; + using key_equal = typename ht::key_equal; using allocator_type = typename ht::allocator_type; - using node_allocator_type = typename ht::node_allocator_type; + using node_allocator_type = typename ht::node_allocator_type; - using size_type = typename ht::size_type; - using difference_type = typename ht::difference_type; - using pointer = typename ht::const_pointer; - using const_pointer = typename ht::const_pointer; - using reference = typename ht::const_reference; - using const_reference = typename ht::const_reference; + using size_type = typename ht::size_type; + using difference_type = typename ht::difference_type; + using pointer = typename ht::const_pointer; + using const_pointer = typename ht::const_pointer; + using reference = typename ht::const_reference; + using const_reference = typename ht::const_reference; - using iterator = typename ht::const_iterator; - using const_iterator = typename ht::const_iterator; - using insert_ctx = typename ht::insert_ctx; + using iterator = typename ht::const_iterator; + using const_iterator = typename ht::const_iterator; + using insert_ctx = typename ht::insert_ctx; hasher hash_function() const { return rep.hash_function(); @@ -285,22 +285,22 @@ private: ht rep; public: - using key_type = typename ht::key_type; - using value_type = typename ht::value_type; - using hasher = typename ht::hasher; - using key_equal = typename ht::key_equal; + using key_type = typename ht::key_type; + using value_type = typename ht::value_type; + using hasher = typename ht::hasher; + using key_equal = typename ht::key_equal; using allocator_type = typename ht::allocator_type; - using node_allocator_type = typename ht::node_allocator_type; + using node_allocator_type = typename ht::node_allocator_type; - using size_type = typename ht::size_type; - using difference_type = typename ht::difference_type; - using pointer = typename ht::const_pointer; - using const_pointer = typename ht::const_pointer; - using reference = typename ht::const_reference; - using const_reference = typename ht::const_reference; + using size_type = typename ht::size_type; + using difference_type = typename ht::difference_type; + using pointer = typename ht::const_pointer; + using const_pointer = typename ht::const_pointer; + using reference = typename ht::const_reference; + using const_reference = typename ht::const_reference; - using iterator = typename ht::const_iterator; - using const_iterator = typename ht::const_iterator; + using iterator = typename ht::const_iterator; + using const_iterator = typename ht::const_iterator; hasher hash_function() const { return rep.hash_function(); diff --git a/util/generic/hash_ut.cpp b/util/generic/hash_ut.cpp index f19218f4b1..0551d58770 100644 --- a/util/generic/hash_ut.cpp +++ b/util/generic/hash_ut.cpp @@ -606,7 +606,7 @@ void THashTest::TestHMSetEmplace() { void THashTest::TestInsertErase() { using hmap = THashMap<TString, size_t, THash<TString>, TEqualTo<TString>>; - using val_type = hmap::value_type; + using val_type = hmap::value_type; { hmap values; @@ -645,7 +645,7 @@ namespace { } }; - using TItemPtr = TIntrusivePtr<TItem>; + using TItemPtr = TIntrusivePtr<TItem>; struct TSelectKey { const TString& operator()(const TItemPtr& item) const { @@ -783,7 +783,7 @@ class TCountingAllocator: public std::allocator<T> { using base_type = std::allocator<T>; public: - using size_type = typename base_type::size_type; + using size_type = typename base_type::size_type; template <class Other> struct rebind { diff --git a/util/generic/intrlist.h b/util/generic/intrlist.h index 88262e3839..b5d3f2051b 100644 --- a/util/generic/intrlist.h +++ b/util/generic/intrlist.h @@ -126,16 +126,16 @@ private: template <class TListItem, class TNode> class TIteratorBase { public: - using TItem = TListItem; - using TReference = TNode&; - using TPointer = TNode*; + using TItem = TListItem; + using TReference = TNode&; + using TPointer = TNode*; using iterator_category = std::bidirectional_iterator_tag; - using difference_type = ptrdiff_t; + using difference_type = ptrdiff_t; - using value_type = TNode; - using reference = TReference; - using pointer = TPointer; + using value_type = TNode; + using reference = TReference; + using pointer = TPointer; inline TIteratorBase() noexcept : Item_(nullptr) @@ -218,16 +218,16 @@ private: template <class TIterator> class TReverseIteratorBase { public: - using TItem = typename TIterator::TItem; - using TReference = typename TIterator::TReference; - using TPointer = typename TIterator::TPointer; + using TItem = typename TIterator::TItem; + using TReference = typename TIterator::TReference; + using TPointer = typename TIterator::TPointer; - using iterator_category = typename TIterator::iterator_category; - using difference_type = typename TIterator::difference_type; + using iterator_category = typename TIterator::iterator_category; + using difference_type = typename TIterator::difference_type; - using value_type = typename TIterator::value_type; - using reference = typename TIterator::reference; - using pointer = typename TIterator::pointer; + using value_type = typename TIterator::value_type; + using reference = typename TIterator::reference; + using pointer = typename TIterator::pointer; inline TReverseIteratorBase() noexcept = default; @@ -315,17 +315,17 @@ private: }; public: - using TIterator = TIteratorBase<TListItem, T>; - using TConstIterator = TIteratorBase<const TListItem, const T>; + using TIterator = TIteratorBase<TListItem, T>; + using TConstIterator = TIteratorBase<const TListItem, const T>; - using TReverseIterator = TReverseIteratorBase<TIterator>; - using TConstReverseIterator = TReverseIteratorBase<TConstIterator>; + using TReverseIterator = TReverseIteratorBase<TIterator>; + using TConstReverseIterator = TReverseIteratorBase<TConstIterator>; - using iterator = TIterator; - using const_iterator = TConstIterator; + using iterator = TIterator; + using const_iterator = TConstIterator; - using reverse_iterator = TReverseIterator; - using const_reverse_iterator = TConstReverseIterator; + using reverse_iterator = TReverseIterator; + using const_reverse_iterator = TConstReverseIterator; public: inline void Swap(TIntrusiveList& right) noexcept { @@ -593,11 +593,11 @@ public: using TReverseIterator = typename TIntrusiveList<T, Tag>::TReverseIterator; using TConstReverseIterator = typename TIntrusiveList<T, Tag>::TConstReverseIterator; - using iterator = TIterator; - using const_iterator = TConstIterator; + using iterator = TIterator; + using const_iterator = TConstIterator; - using reverse_iterator = TReverseIterator; - using const_reverse_iterator = TConstReverseIterator; + using reverse_iterator = TReverseIterator; + using const_reverse_iterator = TConstReverseIterator; public: inline TIntrusiveListWithAutoDelete() noexcept = default; @@ -741,11 +741,11 @@ public: }; public: - using TIterator = TIteratorBase<TListItem, T>; - using TConstIterator = TIteratorBase<const TListItem, const T>; + using TIterator = TIteratorBase<TListItem, T>; + using TConstIterator = TIteratorBase<const TListItem, const T>; - using iterator = TIterator; - using const_iterator = TConstIterator; + using iterator = TIterator; + using const_iterator = TConstIterator; public: inline TIntrusiveSList() noexcept diff --git a/util/generic/map_ut.cpp b/util/generic/map_ut.cpp index 609a73ccde..79e832b024 100644 --- a/util/generic/map_ut.cpp +++ b/util/generic/map_ut.cpp @@ -139,7 +139,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { } using mmap = TMultiMap<int, char, TLess<int>>; - using pair_type = mmap::value_type; + using pair_type = mmap::value_type; pair_type p1(3, 'c'); pair_type p2(6, 'f'); @@ -277,7 +277,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { Y_UNIT_TEST(TestTemplateMethods) { { using Container = TMap<TKey, int, TKeyCmp>; - using value = Container::value_type; + using value = Container::value_type; Container cont; @@ -305,7 +305,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { { using Container = TMap<TKey*, int, TKeyCmpPtr>; - using value = Container::value_type; + using value = Container::value_type; Container cont; @@ -334,7 +334,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { { using Container = TMultiMap<TKey, int, TKeyCmp>; - using value = Container::value_type; + using value = Container::value_type; Container cont; @@ -362,7 +362,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { { using Container = TMultiMap<TKey const volatile*, int, TKeyCmpPtr>; - using value = Container::value_type; + using value = Container::value_type; Container cont; diff --git a/util/generic/noncopyable.h b/util/generic/noncopyable.h index ef5996fd39..c007934133 100644 --- a/util/generic/noncopyable.h +++ b/util/generic/noncopyable.h @@ -34,5 +34,5 @@ namespace NNonCopyable { // protection from unintended ADL }; } -using TNonCopyable = NNonCopyable::TNonCopyable; +using TNonCopyable = NNonCopyable::TNonCopyable; using TMoveOnly = NNonCopyable::TMoveOnly; diff --git a/util/generic/ptr.h b/util/generic/ptr.h index 27034af3c4..19db0e3ec5 100644 --- a/util/generic/ptr.h +++ b/util/generic/ptr.h @@ -778,11 +778,11 @@ typename TSimpleIntrusiveOps<T, Ops>::TFunc TSimpleIntrusiveOps<T, Ops>::Ref_ = template <class T, class Ops> typename TSimpleIntrusiveOps<T, Ops>::TFunc TSimpleIntrusiveOps<T, Ops>::UnRef_ = nullptr; -template <typename T, class Ops = TDefaultIntrusivePtrOps<T>, typename... Args> +template <typename T, class Ops = TDefaultIntrusivePtrOps<T>, typename... Args> [[nodiscard]] TIntrusivePtr<T, Ops> MakeIntrusive(Args&&... args) { return new T{std::forward<Args>(args)...}; -} - +} + template <typename T, class Ops = TDefaultIntrusivePtrOps<T>, typename... Args> [[nodiscard]] TIntrusiveConstPtr<T, Ops> MakeIntrusiveConst(Args&&... args) { return new T{std::forward<Args>(args)...}; diff --git a/util/generic/ptr_ut.cpp b/util/generic/ptr_ut.cpp index 85eaf125a9..c2dcff23f6 100644 --- a/util/generic/ptr_ut.cpp +++ b/util/generic/ptr_ut.cpp @@ -26,7 +26,7 @@ class TPointerTest: public TTestBase { UNIT_TEST(TestIntrusiveConvertion); UNIT_TEST(TestIntrusiveConstConvertion); UNIT_TEST(TestIntrusiveConstConstruction); - UNIT_TEST(TestMakeIntrusive); + UNIT_TEST(TestMakeIntrusive); UNIT_TEST(TestCopyOnWritePtr1); UNIT_TEST(TestCopyOnWritePtr2); UNIT_TEST(TestOperatorBool); @@ -78,7 +78,7 @@ private: void TestIntrusiveConvertion(); void TestIntrusiveConstConvertion(); void TestIntrusiveConstConstruction(); - void TestMakeIntrusive(); + void TestMakeIntrusive(); void TestCopyOnWritePtr1(); void TestCopyOnWritePtr2(); void TestOperatorBool(); @@ -418,17 +418,17 @@ void TPointerTest::TestIntrusiveConstConvertion() { } void TPointerTest::TestMakeIntrusive() { - { - UNIT_ASSERT_VALUES_EQUAL(0, TOp::Cnt); - auto p = MakeIntrusive<TOp>(); - UNIT_ASSERT_VALUES_EQUAL(1, p->RefCount()); - UNIT_ASSERT_VALUES_EQUAL(1, TOp::Cnt); - } + { + UNIT_ASSERT_VALUES_EQUAL(0, TOp::Cnt); + auto p = MakeIntrusive<TOp>(); + UNIT_ASSERT_VALUES_EQUAL(1, p->RefCount()); + UNIT_ASSERT_VALUES_EQUAL(1, TOp::Cnt); + } UNIT_ASSERT_VALUES_EQUAL(TOp::Cnt, 0); -} - +} + void TPointerTest::TestCopyOnWritePtr1() { - using TPtr = TCowPtr<TSimpleSharedPtr<int>>; + using TPtr = TCowPtr<TSimpleSharedPtr<int>>; TPtr p1; UNIT_ASSERT(!p1.Shared()); @@ -484,7 +484,7 @@ struct X: public TSimpleRefCount<X> { }; void TPointerTest::TestCopyOnWritePtr2() { - using TPtr = TCowPtr<TIntrusivePtr<X>>; + using TPtr = TCowPtr<TIntrusivePtr<X>>; TPtr p1; UNIT_ASSERT(!p1.Shared()); @@ -537,7 +537,7 @@ namespace { char t[2]; }; - using RTNo = char; + using RTNo = char; static RTYes Func(TTo); static RTNo Func(...); diff --git a/util/generic/refcount.h b/util/generic/refcount.h index 5d3c7f92d3..966e853b77 100644 --- a/util/generic/refcount.h +++ b/util/generic/refcount.h @@ -81,13 +81,13 @@ private: size_t ThreadId; }; #else -using TCheckPolicy = TNoCheckPolicy; +using TCheckPolicy = TNoCheckPolicy; #endif // Use this one if access from multiple threads to your pointer is an error and you want to enforce thread checks -using TSimpleCounter = TSimpleCounterTemplate<TCheckPolicy>; +using TSimpleCounter = TSimpleCounterTemplate<TCheckPolicy>; // Use this one if you do want to share the pointer between threads, omit thread checks and do the synchronization yourself -using TExplicitSimpleCounter = TSimpleCounterTemplate<TNoCheckPolicy>; +using TExplicitSimpleCounter = TSimpleCounterTemplate<TNoCheckPolicy>; template <class TCounterCheckPolicy> struct TCommonLockOps<TSimpleCounterTemplate<TCounterCheckPolicy>> { diff --git a/util/generic/strbase.h b/util/generic/strbase.h index 988600b51a..ab39fc7537 100644 --- a/util/generic/strbase.h +++ b/util/generic/strbase.h @@ -40,15 +40,15 @@ class TStringBase { using TStringViewWithTraits = std::basic_string_view<TCharType, TTraitsType>; public: - using TChar = TCharType; - using TTraits = TTraitsType; - using TSelf = TStringBase<TDerived, TChar, TTraits>; + using TChar = TCharType; + using TTraits = TTraitsType; + using TSelf = TStringBase<TDerived, TChar, TTraits>; - using size_type = size_t; + using size_type = size_t; using difference_type = ptrdiff_t; static constexpr size_t npos = size_t(-1); - using const_iterator = const TCharType*; + using const_iterator = const TCharType*; using const_reference = const TCharType&; template <typename TBase> @@ -579,7 +579,7 @@ public: } private: - using GenericFinder = const TCharType* (*)(const TCharType*, size_t, const TCharType*, size_t); + using GenericFinder = const TCharType* (*)(const TCharType*, size_t, const TCharType*, size_t); TStringViewWithTraits AsStringView() const { return static_cast<TStringViewWithTraits>(*this); diff --git a/util/generic/strbuf.h b/util/generic/strbuf.h index 09319ca94b..70b9360d58 100644 --- a/util/generic/strbuf.h +++ b/util/generic/strbuf.h @@ -19,7 +19,7 @@ private: public: using char_type = TCharType; // TODO: DROP - using traits_type = TTraits; + using traits_type = TTraits; //Resolving some ambiguity between TStringBase and std::basic_string_view //for typenames diff --git a/util/generic/string.h b/util/generic/string.h index dcd24a240f..8cd8aa6917 100644 --- a/util/generic/string.h +++ b/util/generic/string.h @@ -170,10 +170,10 @@ public: using reference = TBasicCharRef<TBasicString>; #endif using char_type = TCharType; // TODO: DROP - using value_type = TCharType; - using traits_type = TTraits; + using value_type = TCharType; + using traits_type = TTraits; - using iterator = TCharType*; + using iterator = TCharType*; using reverse_iterator = typename TBase::template TReverseIteratorBase<iterator>; using typename TBase::const_iterator; using typename TBase::const_reference; diff --git a/util/generic/typelist.h b/util/generic/typelist.h index aad7231fed..5ce26ab97c 100644 --- a/util/generic/typelist.h +++ b/util/generic/typelist.h @@ -95,8 +95,8 @@ namespace NTL { using T2 = TTypeSelector<wchar_t, T1::TSignedInts, T1::TUnsignedInts>; } -using TSignedInts = NTL::T2::TSignedInts; -using TUnsignedInts = NTL::T2::TUnsignedInts; +using TSignedInts = NTL::T2::TSignedInts; +using TUnsignedInts = NTL::T2::TUnsignedInts; template <unsigned sizeOf> struct TSizeOfPredicate { diff --git a/util/generic/typelist_ut.cpp b/util/generic/typelist_ut.cpp index a55dd400b8..eeabfa97b1 100644 --- a/util/generic/typelist_ut.cpp +++ b/util/generic/typelist_ut.cpp @@ -70,7 +70,7 @@ public: UNIT_ASSERT_TYPES_EQUAL(TListType::TSelectBy<TAnyType>::type, TA); UNIT_ASSERT_TYPES_EQUAL(TListType::TSelectBy<TIs1ArgTemplate>::type, TMyVector<TA>); - using TMyMapPTATB = TMyMap<TA*, TB>; + using TMyMapPTATB = TMyMap<TA*, TB>; UNIT_ASSERT_TYPES_EQUAL(TListType::TSelectBy<TIsNArgTemplate>::type, TMyMapPTATB); } diff --git a/util/generic/typetraits.h b/util/generic/typetraits.h index 13473ea544..d165bd1a06 100644 --- a/util/generic/typetraits.h +++ b/util/generic/typetraits.h @@ -97,7 +97,7 @@ namespace NPrivate { template <class T> class TTypeTraits: public TTypeTraitsBase<T> { - using TBase = TTypeTraitsBase<T>; + using TBase = TTypeTraitsBase<T>; /* * can be effectively passed to function as value diff --git a/util/generic/utility.h b/util/generic/utility.h index c1e9615833..43b98eeafc 100644 --- a/util/generic/utility.h +++ b/util/generic/utility.h @@ -110,7 +110,7 @@ struct TNullTmpl { } }; -using TNull = TNullTmpl<0>; +using TNull = TNullTmpl<0>; /* * Class for zero-initialize padding bytes in derived classes diff --git a/util/generic/vector.h b/util/generic/vector.h index 2be484614e..a5b258955a 100644 --- a/util/generic/vector.h +++ b/util/generic/vector.h @@ -13,7 +13,7 @@ class TVector: public std::vector<T, TReboundAllocator<A, T>> { public: using TBase = std::vector<T, TReboundAllocator<A, T>>; using TSelf = TVector<T, A>; - using size_type = typename TBase::size_type; + using size_type = typename TBase::size_type; inline TVector() : TBase() diff --git a/util/generic/ylimits_ut.cpp b/util/generic/ylimits_ut.cpp index 3b1007e7b9..f1b3c6858c 100644 --- a/util/generic/ylimits_ut.cpp +++ b/util/generic/ylimits_ut.cpp @@ -113,33 +113,33 @@ static inline bool TestNan(const T&) { void TLimitTest::TestLimits() { UNIT_ASSERT(TestIntegralLimits(bool())); UNIT_ASSERT(TestIntegralLimits(char())); - using signed_char = signed char; + using signed_char = signed char; UNIT_ASSERT(TestSignedIntegralLimits(signed_char())); - using unsigned_char = unsigned char; + using unsigned_char = unsigned char; UNIT_ASSERT(TestUnsignedIntegralLimits(unsigned_char())); UNIT_ASSERT(TestSignedIntegralLimits(short())); - using unsigned_short = unsigned short; + using unsigned_short = unsigned short; UNIT_ASSERT(TestUnsignedIntegralLimits(unsigned_short())); UNIT_ASSERT(TestSignedIntegralLimits(int())); - using unsigned_int = unsigned int; + using unsigned_int = unsigned int; UNIT_ASSERT(TestUnsignedIntegralLimits(unsigned_int())); UNIT_ASSERT(TestSignedIntegralLimits(long())); - using unsigned_long = unsigned long; + using unsigned_long = unsigned long; UNIT_ASSERT(TestUnsignedIntegralLimits(unsigned_long())); - using long_long = long long; + using long_long = long long; UNIT_ASSERT(TestSignedIntegralLimits(long_long())); - using unsigned_long_long = unsigned long long; + using unsigned_long_long = unsigned long long; UNIT_ASSERT(TestUnsignedIntegralLimits(unsigned_long_long())); UNIT_ASSERT(TestFloatLimits(float())); UNIT_ASSERT(TestFloatLimits(double())); - using long_double = long double; + using long_double = long double; UNIT_ASSERT(RUNNING_ON_VALGRIND || TestFloatLimits(long_double())); } void TLimitTest::TestNan() { UNIT_ASSERT(::TestNan(float())); UNIT_ASSERT(::TestNan(double())); - using long_double = long double; + using long_double = long double; UNIT_ASSERT(::TestNan(long_double())); } diff --git a/util/memory/blob.cpp b/util/memory/blob.cpp index 5dbc476c47..91da5cadca 100644 --- a/util/memory/blob.cpp +++ b/util/memory/blob.cpp @@ -16,7 +16,7 @@ template <class TCounter> class TDynamicBlobBase: public TBlob::TBase, public TRefCounted<TDynamicBlobBase<TCounter>, TCounter>, public TAdditionalStorage<TDynamicBlobBase<TCounter>> { - using TRefBase = TRefCounted<TDynamicBlobBase, TCounter>; + using TRefBase = TRefCounted<TDynamicBlobBase, TCounter>; public: inline TDynamicBlobBase() = default; @@ -42,7 +42,7 @@ public: template <class TCounter> class TBufferBlobBase: public TBlob::TBase, public TRefCounted<TBufferBlobBase<TCounter>, TCounter> { - using TRefBase = TRefCounted<TBufferBlobBase, TCounter>; + using TRefBase = TRefCounted<TBufferBlobBase, TCounter>; public: inline TBufferBlobBase(TBuffer& buf) { @@ -69,7 +69,7 @@ private: template <class TCounter> class TStringBlobBase: public TBlob::TBase, public TRefCounted<TStringBlobBase<TCounter>, TCounter> { - using TRefBase = TRefCounted<TStringBlobBase, TCounter>; + using TRefBase = TRefCounted<TStringBlobBase, TCounter>; public: inline TStringBlobBase(const TString& s) @@ -102,7 +102,7 @@ private: template <class TCounter> class TMappedBlobBase: public TBlob::TBase, public TRefCounted<TMappedBlobBase<TCounter>, TCounter> { - using TRefBase = TRefCounted<TMappedBlobBase<TCounter>, TCounter>; + using TRefBase = TRefCounted<TMappedBlobBase<TCounter>, TCounter>; public: inline TMappedBlobBase(const TMemoryMap& map, ui64 offset, size_t len, EMappingMode mode) @@ -171,7 +171,7 @@ TBlob TBlob::DeepCopy() const { template <class TCounter> static inline TBlob CopyConstruct(const void* data, size_t len) { - using Base = TDynamicBlobBase<TCounter>; + using Base = TDynamicBlobBase<TCounter>; THolder<Base> base(new (len) Base); Y_ASSERT(base->Length() == len); @@ -198,7 +198,7 @@ TBlob TBlob::NoCopy(const void* data, size_t length) { template <class TCounter> static inline TBlob ConstructFromMap(const TMemoryMap& map, ui64 offset, size_t length, EMappingMode mode) { - using TBase = TMappedBlobBase<TCounter>; + using TBase = TMappedBlobBase<TCounter>; THolder<TBase> base(new TBase(map, offset, length, mode)); TBlob ret(base->Data(), base->Length(), base.Get()); Y_UNUSED(base.Release()); @@ -302,7 +302,7 @@ TBlob TBlob::FromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length) { template <class TCounter> static inline TBlob ReadFromFile(const TFile& file, ui64 offset, size_t length) { - using TBase = TDynamicBlobBase<TCounter>; + using TBase = TDynamicBlobBase<TCounter>; THolder<TBase> base(new (length) TBase); Y_ASSERT(base->Length() == length); @@ -352,7 +352,7 @@ TBlob TBlob::FromFileContent(const TFile& file, ui64 offset, size_t length) { template <class TCounter> static inline TBlob ConstructFromBuffer(TBuffer& in) { - using TBase = TBufferBlobBase<TCounter>; + using TBase = TBufferBlobBase<TCounter>; THolder<TBase> base(new TBase(in)); TBlob ret(base->Buffer().Data(), base->Buffer().Size(), base.Get()); @@ -392,7 +392,7 @@ TBlob TBlob::FromBuffer(TBuffer& in) { template <class TCounter, class S> TBlob ConstructFromString(S&& s) { - using TBase = TStringBlobBase<TCounter>; + using TBase = TStringBlobBase<TCounter>; auto base = MakeHolder<TBase>(std::forward<S>(s)); TBlob ret(base->String().data(), base->String().size(), base.Get()); diff --git a/util/memory/blob.h b/util/memory/blob.h index 9e031f2c88..20c02a68df 100644 --- a/util/memory/blob.h +++ b/util/memory/blob.h @@ -56,9 +56,9 @@ private: public: using value_type = ui8; - using const_reference = const value_type&; - using const_pointer = const value_type*; - using const_iterator = const_pointer; + using const_reference = const value_type&; + using const_pointer = const value_type*; + using const_iterator = const_pointer; /** * Constructs a null blob (data array points to nullptr). diff --git a/util/memory/pool.h b/util/memory/pool.h index 739f861d8f..13c8b6b9ed 100644 --- a/util/memory/pool.h +++ b/util/memory/pool.h @@ -25,7 +25,7 @@ */ class TMemoryPool { private: - using TBlock = IAllocator::TBlock; + using TBlock = IAllocator::TBlock; class TChunk: public TIntrusiveListItem<TChunk> { public: @@ -95,7 +95,7 @@ private: size_t Left_; }; - using TChunkList = TIntrusiveList<TChunk>; + using TChunkList = TIntrusiveList<TChunk>; public: class IGrowPolicy { @@ -353,13 +353,13 @@ private: template <class T, class TPool> class TPoolAllocBase { public: - using pointer = T*; - using const_pointer = const T*; - using reference = T&; - using const_reference = const T&; - using size_type = size_t; - using difference_type = ptrdiff_t; - using value_type = T; + using pointer = T*; + using const_pointer = const T*; + using reference = T&; + using const_reference = const T&; + using size_type = size_t; + using difference_type = ptrdiff_t; + using value_type = T; inline TPoolAllocBase(TPool* pool) : Pool_(pool) @@ -381,7 +381,7 @@ public: template <class T1> struct rebind { - using other = TPoolAllocBase<T1, TPool>; + using other = TPoolAllocBase<T1, TPool>; }; inline size_type max_size() const noexcept { diff --git a/util/memory/segmented_string_pool.h b/util/memory/segmented_string_pool.h index 98428fa991..a40aa408f5 100644 --- a/util/memory/segmented_string_pool.h +++ b/util/memory/segmented_string_pool.h @@ -36,8 +36,8 @@ protected: } }; using seg_container = TVector<seg_inf>; - using seg_iterator = typename seg_container::iterator; - using seg_const_iterator = typename seg_container::const_iterator; + using seg_iterator = typename seg_container::iterator; + using seg_const_iterator = typename seg_container::const_iterator; const size_t segment_size; // default size of a memory chunk in sizeof(T)-units size_t last_free; // size of free memory in chunk in sizeof(T)-units size_t last_ins_size; // size of memory used in chunk by the last append() in bytes @@ -148,7 +148,7 @@ public: class segmented_string_pool: public segmented_pool<char> { private: - using _Base = segmented_pool<char>; + using _Base = segmented_pool<char>; public: segmented_string_pool() diff --git a/util/memory/segpool_alloc.h b/util/memory/segpool_alloc.h index dfe3682939..1a83b7a543 100644 --- a/util/memory/segpool_alloc.h +++ b/util/memory/segpool_alloc.h @@ -30,15 +30,15 @@ template <class _Tp> struct segpool_alloc { - using pool_type = segmented_pool<char>; + using pool_type = segmented_pool<char>; pool_type* pool; - using pointer = _Tp*; - using const_pointer = const _Tp*; - using reference = _Tp&; - using const_reference = const _Tp&; - using size_type = size_t; - using difference_type = ptrdiff_t; - using value_type = _Tp; + using pointer = _Tp*; + using const_pointer = const _Tp*; + using reference = _Tp&; + using const_reference = const _Tp&; + using size_type = size_t; + using difference_type = ptrdiff_t; + using value_type = _Tp; #ifndef NDEBUG ui64 pool_count, malloc_count, pool_free_count, malloc_free_count; #endif @@ -90,7 +90,7 @@ struct segpool_alloc { } template <class _Tp1> struct rebind { - using other = segpool_alloc<_Tp1>; + using other = segpool_alloc<_Tp1>; }; size_type max_size() const { return size_type(-1) / sizeof(_Tp); diff --git a/util/memory/smallobj.h b/util/memory/smallobj.h index 25889e8070..63de666bae 100644 --- a/util/memory/smallobj.h +++ b/util/memory/smallobj.h @@ -30,7 +30,7 @@ class TFixedSizeAllocator { }; public: - using IGrowPolicy = TMemoryPool::IGrowPolicy; + using IGrowPolicy = TMemoryPool::IGrowPolicy; TFixedSizeAllocator(size_t allocSize, IAllocator* alloc) : TFixedSizeAllocator(allocSize, alignof(TAlloc), TMemoryPool::TExpGrow::Instance(), alloc) @@ -80,7 +80,7 @@ private: template <class T> class TSmallObjAllocator { public: - using IGrowPolicy = TFixedSizeAllocator::IGrowPolicy; + using IGrowPolicy = TFixedSizeAllocator::IGrowPolicy; inline TSmallObjAllocator(IAllocator* alloc) : Alloc_(sizeof(T), alignof(T), alloc) diff --git a/util/network/address.h b/util/network/address.h index b2571845d1..448fcac0c9 100644 --- a/util/network/address.h +++ b/util/network/address.h @@ -16,7 +16,7 @@ namespace NAddr { }; using IRemoteAddrPtr = THolder<IRemoteAddr>; - using IRemoteAddrRef = TAtomicSharedPtr<NAddr::IRemoteAddr>; + using IRemoteAddrRef = TAtomicSharedPtr<NAddr::IRemoteAddr>; IRemoteAddrPtr GetSockAddr(SOCKET s); IRemoteAddrPtr GetPeerAddr(SOCKET s); diff --git a/util/network/endpoint.h b/util/network/endpoint.h index c2aecfe3bb..a3e59b4925 100644 --- a/util/network/endpoint.h +++ b/util/network/endpoint.h @@ -7,7 +7,7 @@ //some equivalent boost::asio::ip::endpoint (easy for using pair ip:port) class TEndpoint { public: - using TAddrRef = NAddr::IRemoteAddrRef; + using TAddrRef = NAddr::IRemoteAddrRef; TEndpoint(const TAddrRef& addr); TEndpoint(); diff --git a/util/network/ip.h b/util/network/ip.h index 1697232c0d..dc7c2d24a0 100644 --- a/util/network/ip.h +++ b/util/network/ip.h @@ -9,10 +9,10 @@ #include <util/generic/yexception.h> /// IPv4 address in network format -using TIpHost = ui32; +using TIpHost = ui32; /// Port number in host format -using TIpPort = ui16; +using TIpPort = ui16; /* * ipStr is in 'ddd.ddd.ddd.ddd' format diff --git a/util/network/nonblock.cpp b/util/network/nonblock.cpp index ac1e3eaa6f..e515c27cc5 100644 --- a/util/network/nonblock.cpp +++ b/util/network/nonblock.cpp @@ -89,7 +89,7 @@ namespace { return Singleton<TFeatureCheck>(); } - using TAccept4 = int (*)(int sockfd, struct sockaddr* addr, socklen_t* addrlen, int flags); + using TAccept4 = int (*)(int sockfd, struct sockaddr* addr, socklen_t* addrlen, int flags); TAccept4 Accept4; bool HaveSockNonBlock; }; diff --git a/util/network/poller.cpp b/util/network/poller.cpp index 06ab0d705b..7954d0e8b5 100644 --- a/util/network/poller.cpp +++ b/util/network/poller.cpp @@ -5,7 +5,7 @@ namespace { struct TMutexLocking { - using TMyMutex = TMutex; + using TMyMutex = TMutex; }; } diff --git a/util/network/pollerimpl.h b/util/network/pollerimpl.h index 0dcd82724b..e8c7e40fba 100644 --- a/util/network/pollerimpl.h +++ b/util/network/pollerimpl.h @@ -69,7 +69,7 @@ static inline int MicroToMilli(int timeout) noexcept { } struct TWithoutLocking { - using TMyMutex = TFakeMutex; + using TMyMutex = TFakeMutex; }; #if defined(HAVE_KQUEUE_POLLER) @@ -87,7 +87,7 @@ static inline int Kevent(int kq, struct kevent* changelist, int nchanges, template <class TLockPolicy> class TKqueuePoller { public: - typedef struct ::kevent TEvent; + typedef struct ::kevent TEvent; inline TKqueuePoller() : Fd_(kqueue()) @@ -407,7 +407,7 @@ struct TSelectPollerNoTemplate { template <class TLockPolicy> class TSelectPoller: public TSelectPollerNoTemplate { - using TMyMutex = typename TLockPolicy::TMyMutex; + using TMyMutex = typename TLockPolicy::TMyMutex; public: inline TSelectPoller() @@ -657,7 +657,7 @@ class TGenericPoller: public TBase { public: using TBase::TBase; - using TEvent = typename TBase::TEvent; + using TEvent = typename TBase::TEvent; inline void Set(void* data, SOCKET fd, int what) { if (what) { diff --git a/util/network/sock.h b/util/network/sock.h index fc1b4ed728..b10be2f715 100644 --- a/util/network/sock.h +++ b/util/network/sock.h @@ -339,12 +339,12 @@ struct TSockAddrInet6: public sockaddr_in6, public ISockAddr { } }; -using TSockAddrLocalStream = TSockAddrLocal; -using TSockAddrLocalDgram = TSockAddrLocal; -using TSockAddrInetStream = TSockAddrInet; -using TSockAddrInetDgram = TSockAddrInet; -using TSockAddrInet6Stream = TSockAddrInet6; -using TSockAddrInet6Dgram = TSockAddrInet6; +using TSockAddrLocalStream = TSockAddrLocal; +using TSockAddrLocalDgram = TSockAddrLocal; +using TSockAddrInetStream = TSockAddrInet; +using TSockAddrInetDgram = TSockAddrInet; +using TSockAddrInet6Stream = TSockAddrInet6; +using TSockAddrInet6Dgram = TSockAddrInet6; class TBaseSocket: public TSocketHolder { protected: diff --git a/util/network/socket.cpp b/util/network/socket.cpp index d7963aef00..4f6e804346 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -574,7 +574,7 @@ void TSocketHolder::Close() noexcept { } class TSocket::TImpl: public TAtomicRefCount<TImpl> { - using TOps = TSocket::TOps; + using TOps = TSocket::TOps; public: inline TImpl(SOCKET fd, TOps* ops) @@ -721,7 +721,7 @@ static inline ssize_t DoSendV(SOCKET fd, const struct iovec* iov, size_t count) template <bool isCompat> struct TSender { - using TPart = TSocket::TPart; + using TPart = TSocket::TPart; static inline ssize_t SendV(SOCKET fd, const TPart* parts, size_t count) { return DoSendV(fd, (const iovec*)parts, count); @@ -730,7 +730,7 @@ struct TSender { template <> struct TSender<false> { - using TPart = TSocket::TPart; + using TPart = TSocket::TPart; static inline ssize_t SendV(SOCKET fd, const TPart* parts, size_t count) { TTempBuf tempbuf(sizeof(struct iovec) * count); @@ -749,7 +749,7 @@ struct TSender<false> { }; class TCommonSockOps: public TSocket::TOps { - using TPart = TSocket::TPart; + using TPart = TSocket::TPart; public: inline TCommonSockOps() noexcept { diff --git a/util/random/entropy.cpp b/util/random/entropy.cpp index 70dd290e72..3617edb83d 100644 --- a/util/random/entropy.cpp +++ b/util/random/entropy.cpp @@ -103,8 +103,8 @@ namespace { //not thread-safe class TMersenneInput: public IInputStream { - using TKey = ui64; - using TRnd = TMersenne<TKey>; + using TKey = ui64; + using TRnd = TMersenne<TKey>; public: inline explicit TMersenneInput(const TBuffer& rnd) diff --git a/util/random/random.cpp b/util/random/random.cpp index 43f3403fe5..71f9323856 100644 --- a/util/random/random.cpp +++ b/util/random/random.cpp @@ -54,17 +54,17 @@ namespace { template <unsigned N> struct TToRealTypeBySize { - using TResult = ui32; + using TResult = ui32; }; template <> struct TToRealTypeBySize<8> { - using TResult = ui64; + using TResult = ui64; }; template <class T> struct TToRealType { - using TResult = typename TToRealTypeBySize<sizeof(T)>::TResult; + using TResult = typename TToRealTypeBySize<sizeof(T)>::TResult; }; } diff --git a/util/stream/buffer.cpp b/util/stream/buffer.cpp index 04d4ff84c3..2facece4ea 100644 --- a/util/stream/buffer.cpp +++ b/util/stream/buffer.cpp @@ -44,7 +44,7 @@ private: }; namespace { - using TImpl = TBufferOutput::TImpl; + using TImpl = TBufferOutput::TImpl; class TOwnedImpl: private TBuffer, public TImpl { public: diff --git a/util/stream/buffered.h b/util/stream/buffered.h index c731c7205b..0847186141 100644 --- a/util/stream/buffered.h +++ b/util/stream/buffered.h @@ -182,8 +182,8 @@ namespace NPrivate { */ template <class TSlave> class TBuffered: private TEmbedPolicy<TSlave>, public ::NPrivate::TBufferedStreamFor<TSlave>::TResult { - using TSlaveBase = TEmbedPolicy<TSlave>; - using TBufferedBase = typename ::NPrivate::TBufferedStreamFor<TSlave>::TResult; + using TSlaveBase = TEmbedPolicy<TSlave>; + using TBufferedBase = typename ::NPrivate::TBufferedStreamFor<TSlave>::TResult; public: template <typename... Args> @@ -216,7 +216,7 @@ public: */ template <class TSlave> class TAdaptivelyBuffered: private TEmbedPolicy<TSlave>, public TAdaptiveBufferedOutput { - using TSlaveBase = TEmbedPolicy<TSlave>; + using TSlaveBase = TEmbedPolicy<TSlave>; public: template <typename... Args> diff --git a/util/stream/holder.h b/util/stream/holder.h index f8df838b19..c60a4e510c 100644 --- a/util/stream/holder.h +++ b/util/stream/holder.h @@ -1,13 +1,13 @@ -#pragma once - -#include <util/generic/ptr.h> +#pragma once + +#include <util/generic/ptr.h> #include <utility> #include <type_traits> - + class IInputStream; class IOutputStream; - + namespace NPrivate { template <class Stream, bool isInput = std::is_base_of<IInputStream, Stream>::value> struct TStreamBase { @@ -34,11 +34,11 @@ namespace NPrivate { */ template <class Base, class StreamBase = typename ::NPrivate::TStreamBase<Base>::TType> class THoldingStream: private THolder<StreamBase>, public Base { -public: +public: template <class... Args> inline THoldingStream(THolder<StreamBase> stream, Args&&... args) : THolder<StreamBase>(std::move(stream)) , Base(this->Get(), std::forward<Args>(args)...) - { - } -}; + { + } +}; diff --git a/util/stream/output.cpp b/util/stream/output.cpp index b274146a3a..db81b81b70 100644 --- a/util/stream/output.cpp +++ b/util/stream/output.cpp @@ -236,7 +236,7 @@ void Out<void*>(IOutputStream& o, void* t) { Out<const void*>(o, t); } -using TNullPtr = decltype(nullptr); +using TNullPtr = decltype(nullptr); template <> void Out<TNullPtr>(IOutputStream& o, TTypeTraits<TNullPtr>::TFuncParam) { diff --git a/util/stream/zlib.cpp b/util/stream/zlib.cpp index e32e41887b..60f4e9439f 100644 --- a/util/stream/zlib.cpp +++ b/util/stream/zlib.cpp @@ -184,7 +184,7 @@ namespace { IInputStream* Stream_; }; - using TZeroCopyDecompress = TZLibDecompress::TImpl; + using TZeroCopyDecompress = TZLibDecompress::TImpl; } class TZLibCompress::TImpl: public TAdditionalStorage<TImpl>, private TZLibCommon { diff --git a/util/string/builder.cpp b/util/string/builder.cpp index 532b56de5d..a3821d3399 100644 --- a/util/string/builder.cpp +++ b/util/string/builder.cpp @@ -1,8 +1,8 @@ -#include "builder.h" - -#include <util/stream/output.h> - -template <> +#include "builder.h" + +#include <util/stream/output.h> + +template <> void Out<TStringBuilder>(IOutputStream& os, const TStringBuilder& sb) { os << static_cast<const TString&>(sb); -} +} diff --git a/util/string/builder.h b/util/string/builder.h index 1f0a34787f..7b54821151 100644 --- a/util/string/builder.h +++ b/util/string/builder.h @@ -1,9 +1,9 @@ -#pragma once - -#include <util/stream/str.h> +#pragma once + +#include <util/stream/str.h> #include <utility> #include <util/generic/string.h> - + namespace NPrivateStringBuilder { class TStringBuilder: public TString { public: @@ -20,14 +20,14 @@ namespace NPrivateStringBuilder { TStringOutput Out; }; - + template <class T> static inline TStringBuilder& operator<<(TStringBuilder& builder, const T& t) { builder.Out << t; - + return builder; } - + template <class T> static inline TStringBuilder&& operator<<(TStringBuilder&& builder, const T& t) { builder.Out << t; diff --git a/util/string/builder_ut.cpp b/util/string/builder_ut.cpp index 59270ba2e0..22def683ec 100644 --- a/util/string/builder_ut.cpp +++ b/util/string/builder_ut.cpp @@ -1,42 +1,42 @@ -#include "builder.h" - +#include "builder.h" + #include <library/cpp/testing/unittest/registar.h> - + static void TestEquals(const TString& expected, const TString& actual) { - UNIT_ASSERT_VALUES_EQUAL(expected, actual); -} - -struct TClassWithStreamOperator { - ui32 Id; + UNIT_ASSERT_VALUES_EQUAL(expected, actual); +} + +struct TClassWithStreamOperator { + ui32 Id; TString Name; - + TClassWithStreamOperator(ui32 id, const TString& name) - : Id(id) - , Name(name) - { - } -}; - + : Id(id) + , Name(name) + { + } +}; + IOutputStream& operator<<(IOutputStream& out, const TClassWithStreamOperator& value) { - return out << value.Id << " " << value.Name; -} - + return out << value.Id << " " << value.Name; +} + Y_UNIT_TEST_SUITE(TStringBuilderTest) { Y_UNIT_TEST(TestStringBuilder) { - TestEquals("", TStringBuilder()); - TestEquals("a", TStringBuilder() << "a"); - TestEquals("a1", TStringBuilder() << "a" << 1); - TestEquals("value: 123 name", TStringBuilder() << "value: " << TClassWithStreamOperator(123, "name")); - } - + TestEquals("", TStringBuilder()); + TestEquals("a", TStringBuilder() << "a"); + TestEquals("a1", TStringBuilder() << "a" << 1); + TestEquals("value: 123 name", TStringBuilder() << "value: " << TClassWithStreamOperator(123, "name")); + } + Y_UNIT_TEST(TestStringBuilderOut) { TString s; - TStringOutput out(s); - TStringBuilder sb; - sb << "a"; - out << sb; - TestEquals("a", s); - } + TStringOutput out(s); + TStringBuilder sb; + sb << "a"; + out << sb; + TestEquals("a", s); + } Y_UNIT_TEST(TestStringBuilderRValue) { struct TRValueAcceptTester { @@ -60,4 +60,4 @@ Y_UNIT_TEST_SUITE(TStringBuilderTest) { UNIT_ASSERT(TRValueAcceptTester::IsRValue(TStringBuilder() << b2)); UNIT_ASSERT_VALUES_EQUAL("a1a", TStringBuilder() << b2); } -} +} diff --git a/util/string/cast.h b/util/string/cast.h index 6962d6db0f..90e925c194 100644 --- a/util/string/cast.h +++ b/util/string/cast.h @@ -21,7 +21,7 @@ size_t ToStringImpl(T t, char* buf, size_t len); */ template <class T> inline size_t ToString(const T& t, char* buf, size_t len) { - using TParam = typename TTypeTraits<T>::TFuncParam; + using TParam = typename TTypeTraits<T>::TFuncParam; return ToStringImpl<TParam>(t, buf, len); } diff --git a/util/string/escape.cpp b/util/string/escape.cpp index 05b44d47de..cd09a7dbd0 100644 --- a/util/string/escape.cpp +++ b/util/string/escape.cpp @@ -150,7 +150,7 @@ namespace { template <class TChar> TBasicString<TChar>& EscapeCImpl(const TChar* str, size_t len, TBasicString<TChar>& r) { - using TEscapeUtil = ::TEscapeUtil<TChar>; + using TEscapeUtil = ::TEscapeUtil<TChar>; TChar buffer[TEscapeUtil::ESCAPE_C_BUFFER_SIZE]; diff --git a/util/string/strspn.h b/util/string/strspn.h index c641173836..8229e74a9c 100644 --- a/util/string/strspn.h +++ b/util/string/strspn.h @@ -62,4 +62,4 @@ private: TSetType S_; }; -using TCompactStrSpn = TStrSpnImpl<TBitMap<256>>; +using TCompactStrSpn = TStrSpnImpl<TBitMap<256>>; diff --git a/util/string/vector.cpp b/util/string/vector.cpp index e83189e821..9ba401f0a2 100644 --- a/util/string/vector.cpp +++ b/util/string/vector.cpp @@ -29,7 +29,7 @@ static inline void DoSplit0(C* res, const TBasicStringBuf<TChr> str, TDelim& d, return; } - using TConsumer = TContainerConsumer<C>; + using TConsumer = TContainerConsumer<C>; TConsumer cc(res); if (maxFields) { diff --git a/util/system/atexit.h b/util/system/atexit.h index ed06b86e8e..eb3188615c 100644 --- a/util/system/atexit.h +++ b/util/system/atexit.h @@ -2,8 +2,8 @@ #include "defaults.h" -using TAtExitFunc = void (*)(void*); -using TTraditionalAtExitFunc = void (*)(); +using TAtExitFunc = void (*)(void*); +using TTraditionalAtExitFunc = void (*)(); void AtExit(TAtExitFunc func, void* ctx); void AtExit(TAtExitFunc func, void* ctx, size_t priority); diff --git a/util/system/atomic_ut.cpp b/util/system/atomic_ut.cpp index 896d375c09..07211ffba7 100644 --- a/util/system/atomic_ut.cpp +++ b/util/system/atomic_ut.cpp @@ -194,12 +194,12 @@ UNIT_TEST_SUITE_REGISTRATION(TAtomicTest<TAtomic>); // chooses type *other than* T1 template <typename T1, typename T2, typename T3> struct TChooser { - using TdType = T2; + using TdType = T2; }; template <typename T1, typename T2> struct TChooser<T1, T1, T2> { - using TdType = T2; + using TdType = T2; }; template <typename T1> @@ -208,7 +208,7 @@ struct TChooser<T1, T1, T1> {}; #if defined(__IOS__) && defined(_32_) using TAltAtomic = int; #else -using TAltAtomic = volatile TChooser<TAtomicBase, long, long long>::TdType; +using TAltAtomic = volatile TChooser<TAtomicBase, long, long long>::TdType; #endif class TTTest: public TAtomicTest<TAltAtomic> { diff --git a/util/system/backtrace_ut.cpp b/util/system/backtrace_ut.cpp index f0c6943f6b..9b5ead71bc 100644 --- a/util/system/backtrace_ut.cpp +++ b/util/system/backtrace_ut.cpp @@ -5,7 +5,7 @@ #include <util/stream/output.h> -using PFunc = int (*)(void**, size_t); +using PFunc = int (*)(void**, size_t); int Dbg1(void** buf, size_t len) { volatile int ret = (int)BackTrace(buf, len); diff --git a/util/system/condvar.cpp b/util/system/condvar.cpp index 9e28eb5fd1..62f3d22356 100644 --- a/util/system/condvar.cpp +++ b/util/system/condvar.cpp @@ -19,12 +19,12 @@ namespace { class TCondVarImpl { - using TLock = TAdaptiveLock; + using TLock = TAdaptiveLock; struct TWaitEvent: public TIntrusiveListItem<TWaitEvent>, public TSystemEvent { }; - using TWaitEvents = TIntrusiveList<TWaitEvent>; + using TWaitEvents = TIntrusiveList<TWaitEvent>; public: inline ~TCondVarImpl() { diff --git a/util/system/condvar_ut.cpp b/util/system/condvar_ut.cpp index 5ea8c59f04..5130a18d32 100644 --- a/util/system/condvar_ut.cpp +++ b/util/system/condvar_ut.cpp @@ -40,7 +40,7 @@ class TCondVarTest: public TTestBase { class TThreadTask: public IObjectInQueue { public: - using PFunc = void (TThreadTask::*)(void); + using PFunc = void (TThreadTask::*)(void); TThreadTask(PFunc func, size_t id, size_t totalIds, TSharedData& data) : Func_(func) diff --git a/util/system/event.h b/util/system/event.h index d583cd1fe9..cab2fc478a 100644 --- a/util/system/event.h +++ b/util/system/event.h @@ -3,21 +3,21 @@ #include <util/generic/ptr.h> #include <util/datetime/base.h> -struct TEventResetType { +struct TEventResetType { enum ResetMode { rAuto, // the state will be nonsignaled after Wait() returns rManual, // we need call Reset() to set the state to nonsignaled. }; -}; +}; -/** - * DEPRECATED! - * - * Use TAutoEvent, TManualEvent for the direct replacement. +/** + * DEPRECATED! + * + * Use TAutoEvent, TManualEvent for the direct replacement. * Use TManualEvent to prevent SEGFAULT (http://nga.at.yandex-team.ru/5772). - */ + */ class TSystemEvent: public TEventResetType { -public: +public: TSystemEvent(ResetMode rmode = rManual); TSystemEvent(const TSystemEvent& other) noexcept; TSystemEvent& operator=(const TSystemEvent& other) noexcept; @@ -61,62 +61,62 @@ private: class TEvImpl; TIntrusivePtr<TEvImpl> EvImpl_; }; - + class TAutoEvent: public TSystemEvent { -public: - TAutoEvent() +public: + TAutoEvent() : TSystemEvent(TSystemEvent::rAuto) - { - } - -private: - void Reset() noexcept; -}; - -/** - * Prevents from a "shortcut problem" (see http://nga.at.yandex-team.ru/5772): if Wait will be called after Signaled - * flag set to true in Signal method but before CondVar.BroadCast - Wait will shortcut (without actual wait on condvar). - * If Wait thread will destruct event - Signal thread will do broadcast on a destructed CondVar. - */ -class TManualEvent { -public: - TManualEvent() - : Ev(TEventResetType::rManual) - { - } - - void Reset() noexcept { + { + } + +private: + void Reset() noexcept; +}; + +/** + * Prevents from a "shortcut problem" (see http://nga.at.yandex-team.ru/5772): if Wait will be called after Signaled + * flag set to true in Signal method but before CondVar.BroadCast - Wait will shortcut (without actual wait on condvar). + * If Wait thread will destruct event - Signal thread will do broadcast on a destructed CondVar. + */ +class TManualEvent { +public: + TManualEvent() + : Ev(TEventResetType::rManual) + { + } + + void Reset() noexcept { TSystemEvent{Ev}.Reset(); - } - - void Signal() noexcept { + } + + void Signal() noexcept { TSystemEvent{Ev}.Signal(); - } - - /** return true if signaled, false if timed out. */ - bool WaitD(TInstant deadLine) noexcept { + } + + /** return true if signaled, false if timed out. */ + bool WaitD(TInstant deadLine) noexcept { return TSystemEvent{Ev}.WaitD(deadLine); - } - - /** return true if signaled, false if timed out. */ - inline bool WaitT(TDuration timeOut) noexcept { + } + + /** return true if signaled, false if timed out. */ + inline bool WaitT(TDuration timeOut) noexcept { return TSystemEvent{Ev}.WaitT(timeOut); - } - - /** Wait infinite time */ - inline void WaitI() noexcept { + } + + /** Wait infinite time */ + inline void WaitI() noexcept { TSystemEvent{Ev}.WaitI(); - } - - /** return true if signaled, false if timed out. */ - inline bool Wait(ui32 timer) noexcept { + } + + /** return true if signaled, false if timed out. */ + inline bool Wait(ui32 timer) noexcept { return TSystemEvent{Ev}.Wait(timer); - } - - inline bool Wait() noexcept { + } + + inline bool Wait() noexcept { return TSystemEvent{Ev}.Wait(); - } - -private: + } + +private: TSystemEvent Ev; -}; +}; diff --git a/util/system/event_ut.cpp b/util/system/event_ut.cpp index b7167afa8b..2506cb7a91 100644 --- a/util/system/event_ut.cpp +++ b/util/system/event_ut.cpp @@ -5,7 +5,7 @@ #include <util/thread/pool.h> -namespace { +namespace { struct TSharedData { TSharedData() : Counter(0) @@ -14,7 +14,7 @@ namespace { } TAtomic Counter; - TManualEvent event; + TManualEvent event; bool failed; }; @@ -31,10 +31,10 @@ namespace { if (Id_ == 0) { usleep(100); - bool cond = Data_.Counter == 0; - if (!cond) { - Data_.failed = true; - } + bool cond = Data_.Counter == 0; + if (!cond) { + Data_.failed = true; + } Data_.event.Signal(); } else { while (!Data_.event.WaitT(TDuration::Seconds(100))) { @@ -49,50 +49,50 @@ namespace { }; class TSignalTask: public IObjectInQueue { - private: + private: TManualEvent& Ev_; - - public: + + public: TSignalTask(TManualEvent& ev) : Ev_(ev) - { - } - + { + } + void Process(void*) override { Ev_.Signal(); - } - }; - + } + }; + class TOwnerTask: public IObjectInQueue { - public: - TManualEvent Barrier; - THolder<TManualEvent> Ev; - - public: - TOwnerTask() - : Ev(new TManualEvent) - { - } - + public: + TManualEvent Barrier; + THolder<TManualEvent> Ev; + + public: + TOwnerTask() + : Ev(new TManualEvent) + { + } + void Process(void*) override { - Ev->WaitI(); - Ev.Destroy(); - } - }; - + Ev->WaitI(); + Ev.Destroy(); + } + }; + } - + Y_UNIT_TEST_SUITE(EventTest) { Y_UNIT_TEST(WaitAndSignalTest) { - TSharedData data; + TSharedData data; TThreadPool queue; - queue.Start(5); + queue.Start(5); for (size_t i = 0; i < 5; ++i) { - UNIT_ASSERT(queue.Add(new TThreadTask(data, i))); + UNIT_ASSERT(queue.Add(new TThreadTask(data, i))); } - queue.Stop(); - UNIT_ASSERT(data.Counter == 10); - UNIT_ASSERT(!data.failed); + queue.Stop(); + UNIT_ASSERT(data.Counter == 10); + UNIT_ASSERT(!data.failed); } Y_UNIT_TEST(ConcurrentSignalAndWaitTest) { @@ -112,21 +112,21 @@ Y_UNIT_TEST_SUITE(EventTest) { queue.Stop(); } - /** Test for a problem: http://nga.at.yandex-team.ru/5772 */ + /** Test for a problem: http://nga.at.yandex-team.ru/5772 */ Y_UNIT_TEST(DestructorBeforeSignalFinishTest) { return; TVector<THolder<IObjectInQueue>> tasks; - for (size_t i = 0; i < 1000; ++i) { + for (size_t i = 0; i < 1000; ++i) { auto owner = MakeHolder<TOwnerTask>(); tasks.emplace_back(MakeHolder<TSignalTask>(*owner->Ev)); tasks.emplace_back(std::move(owner)); - } + } TThreadPool queue; queue.Start(4); for (auto& task : tasks) { - UNIT_ASSERT(queue.Add(task.Get())); - } - queue.Stop(); - } -} + UNIT_ASSERT(queue.Add(task.Get())); + } + queue.Stop(); + } +} diff --git a/util/system/fasttime.cpp b/util/system/fasttime.cpp index e7a293761e..057a814f0a 100644 --- a/util/system/fasttime.cpp +++ b/util/system/fasttime.cpp @@ -25,10 +25,10 @@ ui64 InterpolatedMicroSeconds() { #endif namespace { - using TTime = ui64; + using TTime = ui64; struct TSymbols { - using TFunc = int (*)(struct timeval*, struct timezone*); + using TFunc = int (*)(struct timeval*, struct timezone*); inline TSymbols() : Func(nullptr) diff --git a/util/system/fstat.cpp b/util/system/fstat.cpp index ee333369ec..81e98cbc6b 100644 --- a/util/system/fstat.cpp +++ b/util/system/fstat.cpp @@ -36,11 +36,11 @@ ui32 GetFileMode(DWORD fileAttributes) { #define S_ISREG(st_mode) (st_mode & _S_IFREG) #define S_ISLNK(st_mode) (st_mode & _S_IFLNK) -using TSystemFStat = BY_HANDLE_FILE_INFORMATION; +using TSystemFStat = BY_HANDLE_FILE_INFORMATION; #else -using TSystemFStat = struct stat; +using TSystemFStat = struct stat; #endif diff --git a/util/system/hp_timer.h b/util/system/hp_timer.h index 46f37a8f0b..0a4c252ec2 100644 --- a/util/system/hp_timer.h +++ b/util/system/hp_timer.h @@ -3,7 +3,7 @@ #include "defaults.h" namespace NHPTimer { - using STime = i64; + using STime = i64; // May delay for ~50ms to compute frequency double GetSeconds(const STime& a) noexcept; // Returns the current time diff --git a/util/system/mutex_ut.cpp b/util/system/mutex_ut.cpp index cef39de82f..c8d7caafa1 100644 --- a/util/system/mutex_ut.cpp +++ b/util/system/mutex_ut.cpp @@ -29,7 +29,7 @@ class TMutexTest: public TTestBase { class TThreadTask: public IObjectInQueue { public: - using PFunc = void (TThreadTask::*)(void); + using PFunc = void (TThreadTask::*)(void); TThreadTask(PFunc func, TSharedData& data, size_t id) : Func_(func) diff --git a/util/system/pipe.h b/util/system/pipe.h index 2e05dac5b0..75d0360049 100644 --- a/util/system/pipe.h +++ b/util/system/pipe.h @@ -11,7 +11,7 @@ #include <util/network/pair.h> #include <util/generic/noncopyable.h> -using PIPEHANDLE = SOCKET; +using PIPEHANDLE = SOCKET; #define INVALID_PIPEHANDLE INVALID_SOCKET /// Pipe-like object: pipe on POSIX and socket on windows @@ -81,7 +81,7 @@ public: private: class TImpl; - using TImplRef = TSimpleIntrusivePtr<TImpl>; + using TImplRef = TSimpleIntrusivePtr<TImpl>; TImplRef Impl_; }; diff --git a/util/system/rwlock_ut.cpp b/util/system/rwlock_ut.cpp index 9bb33af76c..2b384c05b3 100644 --- a/util/system/rwlock_ut.cpp +++ b/util/system/rwlock_ut.cpp @@ -30,7 +30,7 @@ class TRWMutexTest: public TTestBase { class TThreadTask: public IObjectInQueue { public: - using PFunc = void (TThreadTask::*)(void); + using PFunc = void (TThreadTask::*)(void); TThreadTask(PFunc func, TSharedData& data, size_t id, size_t total) : Func_(func) diff --git a/util/system/shellcommand.cpp b/util/system/shellcommand.cpp index 65980b6b91..b1989b5c8c 100644 --- a/util/system/shellcommand.cpp +++ b/util/system/shellcommand.cpp @@ -25,8 +25,8 @@ #include <sys/wait.h> using TPid = pid_t; -using TWaitResult = pid_t; -using TExitStatus = int; +using TWaitResult = pid_t; +using TExitStatus = int; #define WAIT_PROCEED 0 #if defined(_darwin_) @@ -40,8 +40,8 @@ using TGetGroupListGid = gid_t; #include "winint.h" using TPid = HANDLE; -using TWaitResult = DWORD; -using TExitStatus = DWORD; +using TWaitResult = DWORD; +using TExitStatus = DWORD; #define WAIT_PROCEED WAIT_TIMEOUT #pragma warning(disable : 4296) // 'wait_result >= WAIT_OBJECT_0' : expression is always tru @@ -182,7 +182,7 @@ private: }; #else -using TRealPipeHandle = TPipeHandle; +using TRealPipeHandle = TPipeHandle; using REALPIPEHANDLE = PIPEHANDLE; #define INVALID_REALPIPEHANDLE INVALID_PIPEHANDLE #endif diff --git a/util/system/shellcommand.h b/util/system/shellcommand.h index eba960e280..8730627fe5 100644 --- a/util/system/shellcommand.h +++ b/util/system/shellcommand.h @@ -471,7 +471,7 @@ public: private: class TImpl; - using TImplRef = TSimpleIntrusivePtr<TImpl>; + using TImplRef = TSimpleIntrusivePtr<TImpl>; TImplRef Impl; }; diff --git a/util/system/sys_alloc.h b/util/system/sys_alloc.h index 3f2ea95116..4221a28f8c 100644 --- a/util/system/sys_alloc.h +++ b/util/system/sys_alloc.h @@ -19,20 +19,20 @@ inline void y_deallocate(void* p) { free(p); } -/** - * Behavior of realloc from C++99 to C++11 changed (http://www.cplusplus.com/reference/cstdlib/realloc/). - * - * Our implementation work as C++99: if new_sz == 0 free will be called on 'p' and nullptr returned. - */ +/** + * Behavior of realloc from C++99 to C++11 changed (http://www.cplusplus.com/reference/cstdlib/realloc/). + * + * Our implementation work as C++99: if new_sz == 0 free will be called on 'p' and nullptr returned. + */ inline void* y_reallocate(void* p, size_t new_sz) { - if (!new_sz) { - if (p) { - free(p); - } - - return nullptr; - } - + if (!new_sz) { + if (p) { + free(p); + } + + return nullptr; + } + void* r = realloc(p, new_sz); if (r == nullptr) { diff --git a/util/system/thread.cpp b/util/system/thread.cpp index c2286f66bb..6236746c2d 100644 --- a/util/system/thread.cpp +++ b/util/system/thread.cpp @@ -38,8 +38,8 @@ bool SetHighestThreadPriority() { } namespace { - using TParams = TThread::TParams; - using TId = TThread::TId; + using TParams = TThread::TParams; + using TId = TThread::TId; inline void SetThrName(const TParams& p) { try { @@ -71,7 +71,7 @@ namespace { void* Result; }; - using TParamsRef = TIntrusivePtr<TMyParams>; + using TParamsRef = TIntrusivePtr<TMyParams>; public: inline TWinThread(const TParams& params) @@ -147,7 +147,7 @@ namespace { #endif }; - using TThreadBase = TWinThread; + using TThreadBase = TWinThread; #else //unix @@ -230,7 +230,7 @@ namespace { #undef PCHECK - using TThreadBase = TPosixThread; + using TThreadBase = TPosixThread; #endif template <class T> diff --git a/util/system/thread.h b/util/system/thread.h index b45670f808..a6e8abdb5b 100644 --- a/util/system/thread.h +++ b/util/system/thread.h @@ -18,8 +18,8 @@ class TThread { struct TPrivateCtor {}; public: - using TThreadProc = void* (*)(void*); - using TId = size_t; + using TThreadProc = void* (*)(void*); + using TId = size_t; struct TParams { TThreadProc Proc; diff --git a/util/system/tls.cpp b/util/system/tls.cpp index 330f5a8454..c2f1a04a14 100644 --- a/util/system/tls.cpp +++ b/util/system/tls.cpp @@ -23,7 +23,7 @@ namespace { class TGenericTlsBase { public: - using TSmallKey = size_t; + using TSmallKey = size_t; class TPerThreadStorage { public: @@ -158,7 +158,7 @@ namespace { pthread_key_t Key_; }; - using TKeyDescriptor = TMasterTls::TPerThreadStorage::TKey; + using TKeyDescriptor = TMasterTls::TPerThreadStorage::TKey; } class TKey::TImpl: public TKeyDescriptor { diff --git a/util/system/tls.h b/util/system/tls.h index 3be71d20b8..3c4f56dbeb 100644 --- a/util/system/tls.h +++ b/util/system/tls.h @@ -152,7 +152,7 @@ namespace NPrivate { } namespace NTls { - using TDtor = void (*)(void*); + using TDtor = void (*)(void*); class TKey { public: diff --git a/util/thread/pool.cpp b/util/thread/pool.cpp index e8420eb3c8..05fad02e9b 100644 --- a/util/thread/pool.cpp +++ b/util/thread/pool.cpp @@ -67,7 +67,7 @@ TThreadFactoryHolder::TThreadFactoryHolder() noexcept class TThreadPool::TImpl: public TIntrusiveListItem<TImpl>, public IThreadFactory::IThreadAble { using TTsr = IThreadPool::TTsr; - using TJobQueue = TFastQueue<IObjectInQueue*>; + using TJobQueue = TFastQueue<IObjectInQueue*>; using TThreadRef = THolder<IThreadFactory::IThread>; public: @@ -643,20 +643,20 @@ size_t TSimpleThreadPool::Size() const noexcept { namespace { class TOwnedObjectInQueue: public IObjectInQueue { - private: - THolder<IObjectInQueue> Owned; - - public: + private: + THolder<IObjectInQueue> Owned; + + public: TOwnedObjectInQueue(THolder<IObjectInQueue> owned) : Owned(std::move(owned)) - { - } - + { + } + void Process(void* data) override { - THolder<TOwnedObjectInQueue> self(this); - Owned->Process(data); - } - }; + THolder<TOwnedObjectInQueue> self(this); + Owned->Process(data); + } + }; } void IThreadPool::SafeAdd(IObjectInQueue* obj) { @@ -665,17 +665,17 @@ void IThreadPool::SafeAdd(IObjectInQueue* obj) { void IThreadPool::SafeAddAndOwn(THolder<IObjectInQueue> obj) { Y_ENSURE_EX(AddAndOwn(std::move(obj)), TThreadPoolException() << TStringBuf("can not add to queue and own")); -} - +} + bool IThreadPool::AddAndOwn(THolder<IObjectInQueue> obj) { auto owner = MakeHolder<TOwnedObjectInQueue>(std::move(obj)); - bool added = Add(owner.Get()); - if (added) { + bool added = Add(owner.Get()); + if (added) { Y_UNUSED(owner.Release()); - } - return added; -} - + } + return added; +} + using IThread = IThreadFactory::IThread; using IThreadAble = IThreadFactory::IThreadAble; @@ -721,7 +721,7 @@ namespace { TSystemEvent StartEvent_; }; - using TThreadImplRef = TIntrusivePtr<TThreadImpl>; + using TThreadImplRef = TIntrusivePtr<TThreadImpl>; public: inline TPoolThread(IThreadPool* parent) diff --git a/util/thread/pool_ut.cpp b/util/thread/pool_ut.cpp index 07b0e0a235..893770d0c4 100644 --- a/util/thread/pool_ut.cpp +++ b/util/thread/pool_ut.cpp @@ -32,24 +32,24 @@ struct TThreadPoolTest { }; struct TOwnedTask: public IObjectInQueue { - bool& Processed; - bool& Destructed; - - TOwnedTask(bool& processed, bool& destructed) - : Processed(processed) - , Destructed(destructed) - { - } - + bool& Processed; + bool& Destructed; + + TOwnedTask(bool& processed, bool& destructed) + : Processed(processed) + , Destructed(destructed) + { + } + ~TOwnedTask() override { - Destructed = true; - } - - void Process(void*) override { - Processed = true; - } - }; - + Destructed = true; + } + + void Process(void*) override { + Processed = true; + } + }; + inline void TestAnyQueue(IThreadPool* queue, size_t queueSize = 1000) { TReallyFastRng32 rand(17); const size_t cnt = 1000; @@ -112,18 +112,18 @@ Y_UNIT_TEST_SUITE(TThreadPoolTest) { t.TestAnyQueue(&q); } } - + Y_UNIT_TEST(TestAddAndOwn) { TThreadPool q; - q.Start(2); - bool processed = false; - bool destructed = false; + q.Start(2); + bool processed = false; + bool destructed = false; q.SafeAddAndOwn(MakeHolder<TThreadPoolTest::TOwnedTask>(processed, destructed)); - q.Stop(); - - UNIT_ASSERT_C(processed, "Not processed"); - UNIT_ASSERT_C(destructed, "Not destructed"); - } + q.Stop(); + + UNIT_ASSERT_C(processed, "Not processed"); + UNIT_ASSERT_C(destructed, "Not destructed"); + } Y_UNIT_TEST(TestAddFunc) { TFailAddQueue queue; diff --git a/util/ysaveload.h b/util/ysaveload.h index 57e80e3dc7..02efb4049b 100644 --- a/util/ysaveload.h +++ b/util/ysaveload.h @@ -322,7 +322,7 @@ public: template <class TVec> class TVectorSerializer { - using TIter = typename TVec::iterator; + using TIter = typename TVec::iterator; public: static inline void Save(IOutputStream* rh, const TVec& v) { |