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 | 16747e4f77455cca4932df21eb76f12cb0a97a5c (patch) | |
tree | 4dd6da4102d99d0d69dec53c1050d290a850a9f2 | |
parent | a817f5de12611ec73085eba17f8ec7740a46bdb7 (diff) | |
download | ydb-16747e4f77455cca4932df21eb76f12cb0a97a5c.tar.gz |
Restoring authorship annotation for <spacelord@yandex-team.ru>. Commit 1 of 2.
102 files changed, 735 insertions, 735 deletions
diff --git a/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp b/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp index cd96aa0565..ca0ebb4739 100644 --- a/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp +++ b/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp @@ -715,20 +715,20 @@ namespace NPlugins { } } - void GenerateDeclarations() { - GenerateFieldAccessorDeclarations(); - + void GenerateDeclarations() { + GenerateFieldAccessorDeclarations(); + for (auto& nestedGenerator: NestedGenerators_) { nestedGenerator.GenerateDeclarations(); - } - } - - void GenerateDefinitions() { - GenerateClassExtension(); - GenerateDebugOutputExtension(); - GenerateClassDefinitionExtension(); - } - + } + } + + void GenerateDefinitions() { + GenerateClassExtension(); + GenerateDebugOutputExtension(); + GenerateClassDefinitionExtension(); + } + private: void GenerateFieldAccessorDeclarations() { TProtoStringType fileName = HeaderFileName(Descriptor_->file()); @@ -835,7 +835,7 @@ namespace NPlugins { return; } - TProtoStringType fileName = SourceFileName(Descriptor_->file()); + TProtoStringType fileName = SourceFileName(Descriptor_->file()); TProtoStringType scope = "namespace_scope"; std::unique_ptr<io::ZeroCopyOutputStream> output( OutputDirectory_->OpenForInsert(fileName, scope)); diff --git a/library/cpp/bit_io/bitinout_ut.cpp b/library/cpp/bit_io/bitinout_ut.cpp index 23a1ddf344..3f3e4afcfd 100644 --- a/library/cpp/bit_io/bitinout_ut.cpp +++ b/library/cpp/bit_io/bitinout_ut.cpp @@ -51,7 +51,7 @@ class TBitIOTest: public TTestBase { UNIT_TEST_SUITE_END(); private: - using TBi = NBitIO::TBitInput; + using TBi = NBitIO::TBitInput; using TVec = TVector<char>; void static CheckBits(const TVec& v, const TString& ref, const TString& rem) { diff --git a/library/cpp/charset/recyr_int.hh b/library/cpp/charset/recyr_int.hh index 353af53305..8354687c25 100644 --- a/library/cpp/charset/recyr_int.hh +++ b/library/cpp/charset/recyr_int.hh @@ -178,19 +178,19 @@ namespace NCodepagePrivate { template <class TCharType> struct TCharTypeSwitch<TCharType, 2> { - using TRealCharType = wchar16; + using TRealCharType = wchar16; }; template <class TCharType> struct TCharTypeSwitch<TCharType, 4> { - using TRealCharType = wchar32; + using TRealCharType = wchar32; }; template <class TCharType> inline RECODE_RESULT _recodeUnicodeToUTF8(const TCharType* in, char* out, size_t in_size, size_t out_size, size_t& in_readed, size_t& out_writed) { static_assert(sizeof(TCharType) > 1, "expect some wide type"); - using TRealCharType = typename TCharTypeSwitch<TCharType>::TRealCharType; + using TRealCharType = typename TCharTypeSwitch<TCharType>::TRealCharType; return _recodeUnicodeToUTF8Impl(reinterpret_cast<const TRealCharType*>(in), out, in_size, out_size, in_readed, out_writed); } diff --git a/library/cpp/charset/wide.h b/library/cpp/charset/wide.h index 32d30e849e..db4a178e7e 100644 --- a/library/cpp/charset/wide.h +++ b/library/cpp/charset/wide.h @@ -121,8 +121,8 @@ namespace NDetail { template <> struct TRecodeTraits<char> { - using TCharTo = wchar16; - using TStringBufTo = TWtringBuf; + using TCharTo = wchar16; + using TStringBufTo = TWtringBuf; using TStringTo = TUtf16String; enum { ReserveSize = 4 }; // How many TCharFrom characters we should reserve for one TCharTo character in worst case // Here an unicode character can be converted up to 4 bytes of UTF8 @@ -130,8 +130,8 @@ namespace NDetail { template <> struct TRecodeTraits<wchar16> { - using TCharTo = char; - using TStringBufTo = TStringBuf; + using TCharTo = char; + using TStringBufTo = TStringBuf; using TStringTo = TString; enum { ReserveSize = 2 }; // possible surrogate pairs ? }; @@ -140,7 +140,7 @@ namespace NDetail { template <typename TResult> struct TRecodeResultOps { // default implementation will work with TString and TUtf16String - 99% of usage - using TResultChar = typename TResult::char_type; + using TResultChar = typename TResult::char_type; static inline size_t Size(const TResult& dst) { return dst.size(); @@ -160,7 +160,7 @@ namespace NDetail { template <typename TCharFrom, typename TResult> typename TRecodeTraits<TCharFrom>::TStringBufTo Recode(const TBasicStringBuf<TCharFrom> src, TResult& dst, ECharset encoding) { - using TCharTo = typename TRecodeTraits<TCharFrom>::TCharTo; + using TCharTo = typename TRecodeTraits<TCharFrom>::TCharTo; // make enough room for re-coded string TCharTo* dstbuf = TRecodeResultOps<TResult>::Reserve(dst, src.size() * TRecodeTraits<TCharTo>::ReserveSize); // do re-coding @@ -173,7 +173,7 @@ namespace NDetail { // appending version of Recode() template <typename TCharFrom, typename TResult> typename TRecodeTraits<TCharFrom>::TStringBufTo RecodeAppend(const TBasicStringBuf<TCharFrom> src, TResult& dst, ECharset encoding) { - using TCharTo = typename TRecodeTraits<TCharFrom>::TCharTo; + using TCharTo = typename TRecodeTraits<TCharFrom>::TCharTo; size_t dstOrigSize = TRecodeResultOps<TResult>::Size(dst); TCharTo* dstbuf = TRecodeResultOps<TResult>::Reserve(dst, dstOrigSize + src.size() * TRecodeTraits<TCharTo>::ReserveSize); TBasicStringBuf<TCharTo> appended = NBaseOps::Recode(src, dstbuf + dstOrigSize, encoding); diff --git a/library/cpp/containers/atomizer/atomizer.h b/library/cpp/containers/atomizer/atomizer.h index 5e40f47ab9..164b018e2d 100644 --- a/library/cpp/containers/atomizer/atomizer.h +++ b/library/cpp/containers/atomizer/atomizer.h @@ -20,11 +20,11 @@ private: TVector<const char*> order; public: - using iterator = typename string_hash<ui32, HashFcn, EqualTo>::iterator; - using const_iterator = typename string_hash<ui32, HashFcn, EqualTo>::const_iterator; - using value_type = typename string_hash<ui32, HashFcn, EqualTo>::value_type; - using size_type = typename string_hash<ui32, HashFcn, EqualTo>::size_type; - using pool_size_type = typename string_hash<ui32, HashFcn, EqualTo>::pool_size_type; + using iterator = typename string_hash<ui32, HashFcn, EqualTo>::iterator; + using const_iterator = typename string_hash<ui32, HashFcn, EqualTo>::const_iterator; + using value_type = typename string_hash<ui32, HashFcn, EqualTo>::value_type; + using size_type = typename string_hash<ui32, HashFcn, EqualTo>::size_type; + using pool_size_type = typename string_hash<ui32, HashFcn, EqualTo>::pool_size_type; using string_hash<ui32, HashFcn, EqualTo>::pool; using string_hash<ui32, HashFcn, EqualTo>::size; @@ -112,15 +112,15 @@ private: TOrder order; public: - using iterator = typename string_hash<ui32, HashFcn, EqualTo>::iterator; - using const_iterator = typename string_hash<ui32, HashFcn, EqualTo>::const_iterator; - using value_type = typename string_hash<ui32, HashFcn, EqualTo>::value_type; - using size_type = typename string_hash<ui32, HashFcn, EqualTo>::size_type; - using pool_size_type = typename string_hash<ui32, HashFcn, EqualTo>::pool_size_type; - - using o_iterator = typename TOrder::iterator; - using o_const_iterator = typename TOrder::const_iterator; - using o_value_type = typename TOrder::value_type; + using iterator = typename string_hash<ui32, HashFcn, EqualTo>::iterator; + using const_iterator = typename string_hash<ui32, HashFcn, EqualTo>::const_iterator; + using value_type = typename string_hash<ui32, HashFcn, EqualTo>::value_type; + using size_type = typename string_hash<ui32, HashFcn, EqualTo>::size_type; + using pool_size_type = typename string_hash<ui32, HashFcn, EqualTo>::pool_size_type; + + using o_iterator = typename TOrder::iterator; + using o_const_iterator = typename TOrder::const_iterator; + using o_value_type = typename TOrder::value_type; using string_hash<ui32, HashFcn, EqualTo>::pool; using string_hash<ui32, HashFcn, EqualTo>::size; diff --git a/library/cpp/containers/intrusive_avl_tree/avltree.h b/library/cpp/containers/intrusive_avl_tree/avltree.h index a58c63b07c..a1af47c53a 100644 --- a/library/cpp/containers/intrusive_avl_tree/avltree.h +++ b/library/cpp/containers/intrusive_avl_tree/avltree.h @@ -7,7 +7,7 @@ struct TAvlTreeItem; template <class T, class C> class TAvlTree: public TNonCopyable { - using TTreeItem = TAvlTreeItem<T, C>; + using TTreeItem = TAvlTreeItem<T, C>; friend struct TAvlTreeItem<T, C>; static inline const T* AsT(const TTreeItem* item) noexcept { @@ -178,7 +178,7 @@ class TAvlTree: public TNonCopyable { public: using const_iterator = TConstIterator; - using iterator = TIterator; + using iterator = TIterator; inline TAvlTree() noexcept : Root_(nullptr) @@ -721,7 +721,7 @@ private: template <class T, class C> struct TAvlTreeItem: public TNonCopyable { public: - using TTree = TAvlTree<T, C>; + using TTree = TAvlTree<T, C>; friend class TAvlTree<T, C>; friend typename TAvlTree<T, C>::TConstIterator; friend typename TAvlTree<T, C>::TIterator; diff --git a/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp b/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp index cab2365cce..87807f0492 100644 --- a/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp +++ b/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp @@ -27,7 +27,7 @@ private: int Val; }; - using TIts = TAvlTree<TIt, TItCompare>; + using TIts = TAvlTree<TIt, TItCompare>; }; inline bool TAvlTreeTest::TItCompare::Compare(const TIt& l, const TIt& r) noexcept { diff --git a/library/cpp/containers/intrusive_rb_tree/rb_tree.h b/library/cpp/containers/intrusive_rb_tree/rb_tree.h index 0259452a14..5539d6391b 100644 --- a/library/cpp/containers/intrusive_rb_tree/rb_tree.h +++ b/library/cpp/containers/intrusive_rb_tree/rb_tree.h @@ -3,14 +3,14 @@ #include <util/generic/utility.h> #include <util/generic/yexception.h> -using TRbTreeColorType = bool; +using TRbTreeColorType = bool; #define RBTreeRed false #define RBTreeBlack true struct TRbTreeNodeBase { - using TColorType = TRbTreeColorType; - using TBasePtr = TRbTreeNodeBase*; + using TColorType = TRbTreeColorType; + using TBasePtr = TRbTreeNodeBase*; TColorType Color_; TBasePtr Parent_; @@ -63,7 +63,7 @@ struct TRbTreeBaseIterator; template <class TDummy> class TRbGlobal { public: - using TBasePtr = TRbTreeNodeBase*; + using TBasePtr = TRbTreeNodeBase*; static void Rebalance(TBasePtr x, TBasePtr& root); static TBasePtr RebalanceForErase(TBasePtr z, TBasePtr& root, TBasePtr& leftmost, TBasePtr& rightmost); @@ -76,10 +76,10 @@ public: static void RotateRight(TBasePtr x, TBasePtr& root); }; -using TRbGlobalInst = TRbGlobal<bool>; +using TRbGlobalInst = TRbGlobal<bool>; struct TRbTreeBaseIterator { - using TBasePtr = TRbTreeNodeBase*; + using TBasePtr = TRbTreeNodeBase*; TBasePtr Node_; inline TRbTreeBaseIterator(TBasePtr x = nullptr) noexcept @@ -90,10 +90,10 @@ struct TRbTreeBaseIterator { template <class TValue, class TTraits> struct TRbTreeIterator: public TRbTreeBaseIterator { - using TReference = typename TTraits::TReference; - using TPointer = typename TTraits::TPointer; - using TSelf = TRbTreeIterator<TValue, TTraits>; - using TBasePtr = TRbTreeNodeBase*; + using TReference = typename TTraits::TReference; + using TPointer = typename TTraits::TPointer; + using TSelf = TRbTreeIterator<TValue, TTraits>; + using TBasePtr = TRbTreeNodeBase*; inline TRbTreeIterator() noexcept = default; @@ -161,18 +161,18 @@ class TRbTree { }; struct TNonConstTraits { - using TReference = TValue&; - using TPointer = TValue*; + using TReference = TValue&; + using TPointer = TValue*; }; struct TConstTraits { - using TReference = const TValue&; - using TPointer = const TValue*; + using TReference = const TValue&; + using TPointer = const TValue*; }; - using TNodeBase = TRbTreeNodeBase; - using TBasePtr = TRbTreeNodeBase*; - using TColorType = TRbTreeColorType; + using TNodeBase = TRbTreeNodeBase; + using TBasePtr = TRbTreeNodeBase*; + using TColorType = TRbTreeColorType; public: class TRealNode: public TNodeBase { @@ -206,8 +206,8 @@ public: TRbTree* Tree_; }; - using TIterator = TRbTreeIterator<TValue, TNonConstTraits>; - using TConstIterator = TRbTreeIterator<TValue, TConstTraits>; + using TIterator = TRbTreeIterator<TValue, TNonConstTraits>; + using TConstIterator = TRbTreeIterator<TValue, TConstTraits>; inline TRbTree() noexcept { Init(); diff --git a/library/cpp/containers/intrusive_rb_tree/rb_tree_ut.cpp b/library/cpp/containers/intrusive_rb_tree/rb_tree_ut.cpp index c34ed1fd9b..8eb7cad122 100644 --- a/library/cpp/containers/intrusive_rb_tree/rb_tree_ut.cpp +++ b/library/cpp/containers/intrusive_rb_tree/rb_tree_ut.cpp @@ -34,7 +34,7 @@ class TRedBlackTreeTest: public TTestBase { int N; }; - using TTree = TRbTree<TNode, TCmp>; + using TTree = TRbTree<TNode, TCmp>; UNIT_TEST_SUITE(TRedBlackTreeTest); UNIT_TEST(TestEmpty) diff --git a/library/cpp/containers/str_map/str_map.h b/library/cpp/containers/str_map/str_map.h index 31b00d1b99..b3479867dd 100644 --- a/library/cpp/containers/str_map/str_map.h +++ b/library/cpp/containers/str_map/str_map.h @@ -41,11 +41,11 @@ protected: public: using yh = THashMap<const char*, T, HashFcn, EqualTo, Alloc>; - using iterator = typename yh::iterator; - using const_iterator = typename yh::const_iterator; - using mapped_type = typename yh::mapped_type; - using size_type = typename yh::size_type; - using pool_size_type = typename yh::size_type; + using iterator = typename yh::iterator; + using const_iterator = typename yh::const_iterator; + using mapped_type = typename yh::mapped_type; + using size_type = typename yh::size_type; + using pool_size_type = typename yh::size_type; string_hash() { pool.Reserve(HASH_SIZE_DEFAULT * AVERAGEWORD_BUF); // reserve here } @@ -107,12 +107,12 @@ protected: public: using yh = THashMap<const C*, T, HashFcn, EqualTo>; - using iterator = typename yh::iterator; - using const_iterator = typename yh::const_iterator; - using mapped_type = typename yh::mapped_type; - using size_type = typename yh::size_type; - using key_type = typename yh::key_type; - using value_type = typename yh::value_type; + using iterator = typename yh::iterator; + using const_iterator = typename yh::const_iterator; + using mapped_type = typename yh::mapped_type; + using size_type = typename yh::size_type; + using key_type = typename yh::key_type; + using value_type = typename yh::value_type; THashWithSegmentedPoolForKeys(size_type hash_size = HASH_SIZE_DEFAULT, size_t segsize = HASH_SIZE_DEFAULT * AVERAGEWORD_BUF, bool afs = false) : yh(hash_size) @@ -178,13 +178,13 @@ public: template <class T, class HashFcn, class EqualTo> class segmented_string_hash: public THashWithSegmentedPoolForKeys<char, T, HashFcn, EqualTo> { public: - using Base = THashWithSegmentedPoolForKeys<char, T, HashFcn, EqualTo>; - using iterator = typename Base::iterator; - using const_iterator = typename Base::const_iterator; - using mapped_type = typename Base::mapped_type; - using size_type = typename Base::size_type; - using key_type = typename Base::key_type; - using value_type = typename Base::value_type; + using Base = THashWithSegmentedPoolForKeys<char, T, HashFcn, EqualTo>; + using iterator = typename Base::iterator; + using const_iterator = typename Base::const_iterator; + using mapped_type = typename Base::mapped_type; + using size_type = typename Base::size_type; + using key_type = typename Base::key_type; + using value_type = typename Base::value_type; public: segmented_string_hash(size_type hash_size = HASH_SIZE_DEFAULT, size_t segsize = HASH_SIZE_DEFAULT * AVERAGEWORD_BUF, bool afs = false) diff --git a/library/cpp/deprecated/accessors/accessors_impl.h b/library/cpp/deprecated/accessors/accessors_impl.h index 6b2b987351..63b0fc6783 100644 --- a/library/cpp/deprecated/accessors/accessors_impl.h +++ b/library/cpp/deprecated/accessors/accessors_impl.h @@ -16,7 +16,7 @@ namespace NAccessors { template <typename Ta> struct TBegin: public TMemoryAccessorBase<Ta> { - using TElementType = typename TMemoryTraits<Ta>::TElementType; + using TElementType = typename TMemoryTraits<Ta>::TElementType; template <typename Tb> struct TNoMemoryIndirectionBegin { @@ -57,7 +57,7 @@ namespace NAccessors { std::conditional_t< TMemoryAccessorBase<Ta>::ContinuousMemory, TIndirectMemoryRegionBegin<Ta>, - typename TMemoryAccessorBase<Ta>::TBadAccessor>>; + typename TMemoryAccessorBase<Ta>::TBadAccessor>>; static const TElementType* Get(const Ta& b) { return TGet::Get(b); @@ -66,7 +66,7 @@ namespace NAccessors { template <typename Ta> struct TEnd: public TMemoryAccessorBase<Ta> { - using TElementType = typename TMemoryTraits<Ta>::TElementType; + using TElementType = typename TMemoryTraits<Ta>::TElementType; template <typename Tb> struct TNoMemoryIndirectionEnd { @@ -107,7 +107,7 @@ namespace NAccessors { std::conditional_t< TMemoryAccessorBase<Ta>::ContinuousMemory, TIndirectMemoryRegionEnd<Ta>, - typename TMemoryAccessorBase<Ta>::TBadAccessor>>; + typename TMemoryAccessorBase<Ta>::TBadAccessor>>; static const TElementType* Get(const Ta& b) { return TGet::Get(b); @@ -345,7 +345,7 @@ namespace NAccessors { template <typename Ta> struct TAssign: public TMemoryAccessorBase<Ta> { - using TElementType = typename TMemoryTraits<Ta>::TElementType; + using TElementType = typename TMemoryTraits<Ta>::TElementType; template <typename Tb> struct TNoMemoryIndirectionAssign { @@ -403,7 +403,7 @@ namespace NAccessors { std::conditional_t< TMemoryTraits<Tb>::OwnsMemory, TByClearAppend<Tb>, - TByConstruction<Tb>>>>; + TByConstruction<Tb>>>>; static void Do(Tb& b, const TElementType* beg, const TElementType* end) { TDo::Do(b, beg, end); diff --git a/library/cpp/deprecated/accessors/memory_traits.h b/library/cpp/deprecated/accessors/memory_traits.h index aa837705d3..3905728676 100644 --- a/library/cpp/deprecated/accessors/memory_traits.h +++ b/library/cpp/deprecated/accessors/memory_traits.h @@ -21,7 +21,7 @@ struct TMemoryTraits { OwnsMemory = SimpleMemory, }; - using TElementType = T; + using TElementType = T; }; template <typename T, size_t n> @@ -32,7 +32,7 @@ struct TMemoryTraits<T[n]> { OwnsMemory = SimpleMemory, }; - using TElementType = T; + using TElementType = T; }; template <typename T, size_t n> @@ -43,7 +43,7 @@ struct TMemoryTraits<std::array<T, n>> { OwnsMemory = SimpleMemory, }; - using TElementType = T; + using TElementType = T; }; template <typename A, typename B> @@ -65,7 +65,7 @@ struct TMemoryTraits<TBuffer> { OwnsMemory = true, }; - using TElementType = char; + using TElementType = char; }; template <> @@ -76,7 +76,7 @@ struct TMemoryTraits<TTempBuf> { OwnsMemory = true, }; - using TElementType = char; + using TElementType = char; }; template <> @@ -87,7 +87,7 @@ struct TMemoryTraits< ::TBlob> { OwnsMemory = true, }; - using TElementType = char; + using TElementType = char; }; template <typename T> @@ -97,7 +97,7 @@ struct TElementDependentMemoryTraits { ContinuousMemory = TMemoryTraits<T>::SimpleMemory, }; - using TElementType = T; + using TElementType = T; }; template <typename T, typename TAlloc> diff --git a/library/cpp/deprecated/split/split_iterator.h b/library/cpp/deprecated/split/split_iterator.h index 0eacc29228..dfa0b3420f 100644 --- a/library/cpp/deprecated/split/split_iterator.h +++ b/library/cpp/deprecated/split/split_iterator.h @@ -41,8 +41,8 @@ struct TNumPair { } }; -using TSizeTRegion = TNumPair<size_t>; -using TUi32Region = TNumPair<ui32>; +using TSizeTRegion = TNumPair<size_t>; +using TUi32Region = TNumPair<ui32>; template <> inline TString ToString(const TUi32Region& r) { @@ -103,7 +103,7 @@ private: const TSplitDelimiters& Delimiters; public: - using TIterator = TSplitIterator<TDelimitersSplit>; + using TIterator = TSplitIterator<TDelimitersSplit>; friend class TSplitIterator<TDelimitersSplit>; TDelimitersSplit(const char* str, size_t length, const TSplitDelimiters& delimiters); @@ -124,7 +124,7 @@ private: const TSplitDelimiters& Delimiters; public: - using TIterator = TSplitIterator<TDelimitersStrictSplit>; + using TIterator = TSplitIterator<TDelimitersStrictSplit>; friend class TSplitIterator<TDelimitersStrictSplit>; TDelimitersStrictSplit(const char* str, size_t length, const TSplitDelimiters& delimiters); @@ -146,7 +146,7 @@ private: const TSplitDelimiters& Screens; public: - using TIterator = TSplitIterator<TScreenedDelimitersSplit>; + using TIterator = TSplitIterator<TScreenedDelimitersSplit>; friend class TSplitIterator<TScreenedDelimitersSplit>; TScreenedDelimitersSplit(const char*, size_t, const TSplitDelimiters& delimiters, const TSplitDelimiters& screens); @@ -169,7 +169,7 @@ private: size_t SkipDelimiters(size_t pos) const; public: - using TIterator = TSplitIterator<TDelimitersSplitWithoutTags>; + using TIterator = TSplitIterator<TDelimitersSplitWithoutTags>; friend class TSplitIterator<TDelimitersSplitWithoutTags>; TDelimitersSplitWithoutTags(const char* str, size_t length, const TSplitDelimiters& delimiters); @@ -187,7 +187,7 @@ private: class TCharSplit: public TSplitBase { public: - using TIterator = TSplitIterator<TCharSplit>; + using TIterator = TSplitIterator<TCharSplit>; friend class TSplitIterator<TCharSplit>; TCharSplit(const char* str, size_t length); @@ -211,7 +211,7 @@ private: size_t SkipDelimiters(size_t pos) const; public: - using TIterator = TSplitIterator<TCharSplitWithoutTags>; + using TIterator = TSplitIterator<TCharSplitWithoutTags>; friend class TSplitIterator<TCharSplitWithoutTags>; TCharSplitWithoutTags(const char* str, size_t length); @@ -238,7 +238,7 @@ private: const TSubstringSplitDelimiter& Delimiter; public: - using TIterator = TSplitIterator<TSubstringSplit>; + using TIterator = TSplitIterator<TSubstringSplit>; friend class TSplitIterator<TSubstringSplit>; TSubstringSplit(const char* str, size_t length, const TSubstringSplitDelimiter& delimiter); diff --git a/library/cpp/digest/lower_case/lchash.h b/library/cpp/digest/lower_case/lchash.h index 6a287d9479..6cb109c2e9 100644 --- a/library/cpp/digest/lower_case/lchash.h +++ b/library/cpp/digest/lower_case/lchash.h @@ -7,7 +7,7 @@ template <class T> static inline T FnvCaseLess(const char* b, size_t l, T t = 0) noexcept { - using TIter = TLowerCaseIterator<const char>; + using TIter = TLowerCaseIterator<const char>; return FnvHash(TIter(b), TIter(b + l), t); } diff --git a/library/cpp/retry/retry.cpp b/library/cpp/retry/retry.cpp index 92466cdeca..efb2ec3dbc 100644 --- a/library/cpp/retry/retry.cpp +++ b/library/cpp/retry/retry.cpp @@ -1,10 +1,10 @@ -#include "retry.h" - -#include <util/stream/output.h> - +#include "retry.h" + +#include <util/stream/output.h> + void DoWithRetry(std::function<void()> func, TRetryOptions retryOptions) { - DoWithRetry(func, retryOptions, true); -} + DoWithRetry(func, retryOptions, true); +} bool DoWithRetryOnRetCode(std::function<bool()> func, TRetryOptions retryOptions) { for (ui32 attempt = 0; attempt <= retryOptions.RetryCount; ++attempt) { diff --git a/library/cpp/retry/retry.h b/library/cpp/retry/retry.h index c47ff5070f..dc70f953b0 100644 --- a/library/cpp/retry/retry.h +++ b/library/cpp/retry/retry.h @@ -1,15 +1,15 @@ -#pragma once - +#pragma once + #include "utils.h" #include <library/cpp/retry/protos/retry_options.pb.h> -#include <util/datetime/base.h> -#include <util/generic/maybe.h> -#include <util/generic/typetraits.h> -#include <util/generic/yexception.h> +#include <util/datetime/base.h> +#include <util/generic/maybe.h> +#include <util/generic/typetraits.h> +#include <util/generic/yexception.h> #include <functional> - + struct TRetryOptions { ui32 RetryCount; @@ -18,7 +18,7 @@ struct TRetryOptions { TDuration SleepRandomDelta; TDuration SleepIncrement; TDuration SleepExponentialMultiplier; - + std::function<void(TDuration)> SleepFunction; TRetryOptions(ui32 retryCount = 3, TDuration sleepDuration = TDuration::Seconds(1), TDuration sleepRandomDelta = TDuration::Zero(), @@ -32,17 +32,17 @@ struct TRetryOptions { , SleepFunction(sleepFunction) { } - + TRetryOptions& WithCount(ui32 retryCount) { RetryCount = retryCount; return *this; } - + TRetryOptions& WithSleep(TDuration sleepDuration) { SleepDuration = sleepDuration; return *this; } - + TRetryOptions& WithRandomDelta(TDuration sleepRandomDelta) { SleepRandomDelta = sleepRandomDelta; return *this; @@ -71,16 +71,16 @@ struct TRetryOptions { static TRetryOptions Count(ui32 retryCount) { return TRetryOptions(retryCount); } - + static TRetryOptions Default() { return TRetryOptions(); - } - + } + static TRetryOptions NoRetry() { return TRetryOptions(0); - } + } }; - + template <typename TResult, typename TException = yexception> TMaybe<TResult> DoWithRetry(std::function<TResult()> func, std::function<void(const TException&)> onFail, TRetryOptions retryOptions, bool throwLast) { for (ui32 attempt = 0; attempt <= retryOptions.RetryCount; ++attempt) { @@ -91,16 +91,16 @@ TMaybe<TResult> DoWithRetry(std::function<TResult()> func, std::function<void(co if (attempt == retryOptions.RetryCount) { if (throwLast) { throw; - } + } } else { auto sleep = retryOptions.SleepFunction; sleep(retryOptions.GetTimeToSleep(attempt)); - } - } - } + } + } + } return Nothing(); } - + template <typename TResult, typename TException = yexception> TMaybe<TResult> DoWithRetry(std::function<TResult()> func, TRetryOptions retryOptions, bool throwLast) { return DoWithRetry<TResult, TException>(func, [](const TException&){}, retryOptions, throwLast); @@ -123,9 +123,9 @@ bool DoWithRetry(std::function<void()> func, TRetryOptions retryOptions, bool th }; return DoWithRetry<void*, TException>(f, [](const TException&){}, retryOptions, throwLast).Defined(); } - + void DoWithRetry(std::function<void()> func, TRetryOptions retryOptions); - + bool DoWithRetryOnRetCode(std::function<bool()> func, TRetryOptions retryOptions); Y_DECLARE_PODTYPE(TRetryOptions); diff --git a/util/charset/unicode_table.h b/util/charset/unicode_table.h index 9e171b2583..0918802908 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 400d314186..1323635ac4 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 5e902b8f63..9746cc9d1c 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 afc3f802eb..d7fef849db 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 c25f175d54..4a2946360d 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 1c62055bd9..f190b8ac94 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 eb947cd2cd..ea72457f47 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 ffc9b09f96..72cb802a9c 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 69e025b9c4..3463d87b50 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 bfe0c67d68..02e9883171 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 2fb4d6b4ef..e2ccac8775 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 e6a3451016..d79b8da97c 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 81d439a727..7c6414749e 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 d134338e35..d40e81b0d1 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 f77d182460..8f7d3f2aa4 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 087d34a8dc..2d4751e660 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 9576467404..800a556633 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 e46db21fa9..77eef28ffa 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 e8088cf23b..c35c7ceaef 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 0551d58770..f19218f4b1 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 b5d3f2051b..88262e3839 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 79e832b024..609a73ccde 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 c007934133..ef5996fd39 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 19db0e3ec5..27034af3c4 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 c2dcff23f6..85eaf125a9 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 966e853b77..5d3c7f92d3 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 ab39fc7537..988600b51a 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 70b9360d58..09319ca94b 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 8cd8aa6917..dcd24a240f 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 5ce26ab97c..aad7231fed 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 eeabfa97b1..a55dd400b8 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 d165bd1a06..13473ea544 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 43b98eeafc..c1e9615833 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 a5b258955a..2be484614e 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 f1b3c6858c..3b1007e7b9 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 91da5cadca..5dbc476c47 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 20c02a68df..9e031f2c88 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 13c8b6b9ed..739f861d8f 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 a40aa408f5..98428fa991 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 1a83b7a543..dfe3682939 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 63de666bae..25889e8070 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 448fcac0c9..b2571845d1 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 a3e59b4925..c2aecfe3bb 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 dc7c2d24a0..1697232c0d 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 e515c27cc5..ac1e3eaa6f 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 7954d0e8b5..06ab0d705b 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 e8c7e40fba..0dcd82724b 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 b10be2f715..fc1b4ed728 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 4f6e804346..d7963aef00 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 3617edb83d..70dd290e72 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 71f9323856..43f3403fe5 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 2facece4ea..04d4ff84c3 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 0847186141..c731c7205b 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 c60a4e510c..f8df838b19 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 db81b81b70..b274146a3a 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 60f4e9439f..e32e41887b 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 a3821d3399..532b56de5d 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 7b54821151..1f0a34787f 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 22def683ec..59270ba2e0 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 90e925c194..6962d6db0f 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 cd09a7dbd0..05b44d47de 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 8229e74a9c..c641173836 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 9ba401f0a2..e83189e821 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 eb3188615c..ed06b86e8e 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 07211ffba7..896d375c09 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 9b5ead71bc..f0c6943f6b 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 62f3d22356..9e28eb5fd1 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 5130a18d32..5ea8c59f04 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 cab2fc478a..d583cd1fe9 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 2506cb7a91..b7167afa8b 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 057a814f0a..e7a293761e 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 81e98cbc6b..ee333369ec 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 0a4c252ec2..46f37a8f0b 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 c8d7caafa1..cef39de82f 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 75d0360049..2e05dac5b0 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 2b384c05b3..9bb33af76c 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 b1989b5c8c..65980b6b91 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 8730627fe5..eba960e280 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 4221a28f8c..3f2ea95116 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 6236746c2d..c2286f66bb 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 a6e8abdb5b..b45670f808 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 c2f1a04a14..330f5a8454 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 3c4f56dbeb..3be71d20b8 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 05fad02e9b..e8420eb3c8 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 893770d0c4..07b0e0a235 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 02efb4049b..57e80e3dc7 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) { |