diff --git a/client/ydb_persqueue_core/impl/common.h b/client/ydb_persqueue_core/impl/common.h index 1d3cf2c684..c2f159e67b 100644 --- a/client/ydb_persqueue_core/impl/common.h +++ b/client/ydb_persqueue_core/impl/common.h @@ -3,7 +3,6 @@ #include #include -#include #include #include @@ -470,7 +469,7 @@ class TSerialExecutor : public IAsyncExecutor, public std::enable_shared_from_th IAsyncExecutor::TPtr Executor; //!< Wrapped executor that is actually doing the job bool Busy = false; //!< Set if some closure was scheduled for execution and did not finish yet std::mutex Mutex; - TQueue ExecutionQueue = {}; + std::queue ExecutionQueue = {}; public: TSerialExecutor(IAsyncExecutor::TPtr executor); diff --git a/client/ydb_persqueue_core/ut/basic_usage_ut.cpp b/client/ydb_persqueue_core/ut/basic_usage_ut.cpp index 1aab1f1175..674e6ec434 100644 --- a/client/ydb_persqueue_core/ut/basic_usage_ut.cpp +++ b/client/ydb_persqueue_core/ut/basic_usage_ut.cpp @@ -5,7 +5,6 @@ #include #include -#include #include #include #include diff --git a/client/ydb_persqueue_core/ut/ut_utils/ut_utils.h b/client/ydb_persqueue_core/ut/ut_utils/ut_utils.h index 9cc82f57c7..b4e2f47182 100644 --- a/client/ydb_persqueue_core/ut/ut_utils/ut_utils.h +++ b/client/ydb_persqueue_core/ut/ut_utils/ut_utils.h @@ -4,6 +4,7 @@ #include #include #include +#include using namespace NKikimr; using namespace NKikimr::NPersQueueTests; @@ -387,7 +388,7 @@ class TYdbPqTestExecutor : public IAsyncExecutor { TLockFreeQueue TasksQueue; std::shared_ptr> ExecIdsQueue; THashMap Tasks; - TQueue ExecIds; + std::queue ExecIds; ui64 CurrentTaskId = 0; TThread Thread; diff --git a/client/ydb_topic/impl/executor.h b/client/ydb_topic/impl/executor.h index 344173eae4..12e9d5136b 100644 --- a/client/ydb_topic/impl/executor.h +++ b/client/ydb_topic/impl/executor.h @@ -3,7 +3,6 @@ #include #include -#include #include @@ -58,7 +57,7 @@ class TSerialExecutor : public IAsyncExecutor, public std::enable_shared_from_th IAsyncExecutor::TPtr Executor; //!< Wrapped executor that is actually doing the job bool Busy = false; //!< Set if some closure was scheduled for execution and did not finish yet std::mutex Mutex = {}; - TQueue ExecutionQueue = {}; + std::queue ExecutionQueue = {}; public: TSerialExecutor(IAsyncExecutor::TPtr executor); diff --git a/util/CMakeLists.darwin-arm64.txt b/util/CMakeLists.darwin-arm64.txt index 66729a4adf..0adb5cff2f 100644 --- a/util/CMakeLists.darwin-arm64.txt +++ b/util/CMakeLists.darwin-arm64.txt @@ -96,7 +96,6 @@ target_joined_source(yutil ${CMAKE_SOURCE_DIR}/util/generic/object_counter.cpp ${CMAKE_SOURCE_DIR}/util/generic/overloaded.cpp ${CMAKE_SOURCE_DIR}/util/generic/ptr.cpp - ${CMAKE_SOURCE_DIR}/util/generic/queue.cpp ${CMAKE_SOURCE_DIR}/util/generic/refcount.cpp ${CMAKE_SOURCE_DIR}/util/generic/scope.cpp ${CMAKE_SOURCE_DIR}/util/generic/set.cpp diff --git a/util/CMakeLists.darwin-x86_64.txt b/util/CMakeLists.darwin-x86_64.txt index 9ee14eb653..45cba31b02 100644 --- a/util/CMakeLists.darwin-x86_64.txt +++ b/util/CMakeLists.darwin-x86_64.txt @@ -95,7 +95,6 @@ target_joined_source(yutil ${CMAKE_SOURCE_DIR}/util/generic/object_counter.cpp ${CMAKE_SOURCE_DIR}/util/generic/overloaded.cpp ${CMAKE_SOURCE_DIR}/util/generic/ptr.cpp - ${CMAKE_SOURCE_DIR}/util/generic/queue.cpp ${CMAKE_SOURCE_DIR}/util/generic/refcount.cpp ${CMAKE_SOURCE_DIR}/util/generic/scope.cpp ${CMAKE_SOURCE_DIR}/util/generic/set.cpp diff --git a/util/CMakeLists.linux-aarch64.txt b/util/CMakeLists.linux-aarch64.txt index ca3217531f..80d727d92c 100644 --- a/util/CMakeLists.linux-aarch64.txt +++ b/util/CMakeLists.linux-aarch64.txt @@ -99,7 +99,6 @@ target_joined_source(yutil ${CMAKE_SOURCE_DIR}/util/generic/object_counter.cpp ${CMAKE_SOURCE_DIR}/util/generic/overloaded.cpp ${CMAKE_SOURCE_DIR}/util/generic/ptr.cpp - ${CMAKE_SOURCE_DIR}/util/generic/queue.cpp ${CMAKE_SOURCE_DIR}/util/generic/refcount.cpp ${CMAKE_SOURCE_DIR}/util/generic/scope.cpp ${CMAKE_SOURCE_DIR}/util/generic/set.cpp diff --git a/util/CMakeLists.linux-x86_64.txt b/util/CMakeLists.linux-x86_64.txt index 2c64eeba6d..d78b596a20 100644 --- a/util/CMakeLists.linux-x86_64.txt +++ b/util/CMakeLists.linux-x86_64.txt @@ -99,7 +99,6 @@ target_joined_source(yutil ${CMAKE_SOURCE_DIR}/util/generic/object_counter.cpp ${CMAKE_SOURCE_DIR}/util/generic/overloaded.cpp ${CMAKE_SOURCE_DIR}/util/generic/ptr.cpp - ${CMAKE_SOURCE_DIR}/util/generic/queue.cpp ${CMAKE_SOURCE_DIR}/util/generic/refcount.cpp ${CMAKE_SOURCE_DIR}/util/generic/scope.cpp ${CMAKE_SOURCE_DIR}/util/generic/set.cpp diff --git a/util/CMakeLists.windows-x86_64.txt b/util/CMakeLists.windows-x86_64.txt index 8946eadaf7..c4668b9ef4 100644 --- a/util/CMakeLists.windows-x86_64.txt +++ b/util/CMakeLists.windows-x86_64.txt @@ -102,7 +102,6 @@ target_joined_source(yutil ${CMAKE_SOURCE_DIR}/util/generic/object_counter.cpp ${CMAKE_SOURCE_DIR}/util/generic/overloaded.cpp ${CMAKE_SOURCE_DIR}/util/generic/ptr.cpp - ${CMAKE_SOURCE_DIR}/util/generic/queue.cpp ${CMAKE_SOURCE_DIR}/util/generic/refcount.cpp ${CMAKE_SOURCE_DIR}/util/generic/scope.cpp ${CMAKE_SOURCE_DIR}/util/generic/set.cpp diff --git a/util/generic/fwd.h b/util/generic/fwd.h index 84da6f5fdf..bafa68bf68 100644 --- a/util/generic/fwd.h +++ b/util/generic/fwd.h @@ -44,12 +44,6 @@ class TVector; template > class TDeque; -template > -class TQueue; - -template , class C = TLess> -class TPriorityQueue; - template , class EqualKey = TEqualTo, class Alloc = std::allocator> class THashMap; diff --git a/util/generic/queue.cpp b/util/generic/queue.cpp deleted file mode 100644 index 4ebd3f3205..0000000000 --- a/util/generic/queue.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "queue.h" diff --git a/util/generic/queue.h b/util/generic/queue.h deleted file mode 100644 index 37edf33493..0000000000 --- a/util/generic/queue.h +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -#include "fwd.h" -#include "deque.h" -#include "utility.h" - -#include - -#include - -template -class TQueue: public std::queue { - using TBase = std::queue; - -public: - using TBase::TBase; - - inline explicit operator bool() const noexcept { - return !this->empty(); - } - - inline void clear() { - this->c.clear(); - } - - inline S& Container() { - return this->c; - } - - inline const S& Container() const { - return this->c; - } -}; - -template -class TPriorityQueue: public std::priority_queue { - using TBase = std::priority_queue; - -public: - using TBase::TBase; - - inline explicit operator bool() const noexcept { - return !this->empty(); - } - - inline void clear() { - this->c.clear(); - } - - inline S& Container() { - return this->c; - } - - inline const S& Container() const { - return this->c; - } -}; diff --git a/util/generic/queue_ut.cpp b/util/generic/queue_ut.cpp deleted file mode 100644 index 0fd19392ab..0000000000 --- a/util/generic/queue_ut.cpp +++ /dev/null @@ -1,210 +0,0 @@ -#include "queue.h" -#include "list.h" -#include "vector.h" - -#include - -#include - -Y_UNIT_TEST_SUITE(TYQueueTest) { - Y_UNIT_TEST(ConstructorsAndAssignments) { - { - using container = TQueue; - - container c1; - UNIT_ASSERT(!c1); - c1.push(100); - c1.push(200); - UNIT_ASSERT(c1); - - container c2(c1); - - UNIT_ASSERT_VALUES_EQUAL(2, c1.size()); - UNIT_ASSERT_VALUES_EQUAL(2, c2.size()); - - container c3(std::move(c1)); - - UNIT_ASSERT_VALUES_EQUAL(0, c1.size()); - UNIT_ASSERT_VALUES_EQUAL(2, c3.size()); - - c2.push(300); - c3 = c2; - - UNIT_ASSERT_VALUES_EQUAL(3, c2.size()); - UNIT_ASSERT_VALUES_EQUAL(3, c3.size()); - - c2.push(400); - c3 = std::move(c2); - - UNIT_ASSERT_VALUES_EQUAL(0, c2.size()); - UNIT_ASSERT_VALUES_EQUAL(4, c3.size()); - } - - { - using container = TPriorityQueue; - - container c1; - UNIT_ASSERT(!c1); - c1.push(100); - c1.push(200); - UNIT_ASSERT(c1); - - container c2(c1); - - UNIT_ASSERT_VALUES_EQUAL(2, c1.size()); - UNIT_ASSERT_VALUES_EQUAL(2, c2.size()); - - container c3(std::move(c1)); - - UNIT_ASSERT_VALUES_EQUAL(0, c1.size()); - UNIT_ASSERT_VALUES_EQUAL(2, c3.size()); - - c2.push(300); - c3 = c2; - - UNIT_ASSERT_VALUES_EQUAL(3, c2.size()); - UNIT_ASSERT_VALUES_EQUAL(3, c3.size()); - - c2.push(400); - c3 = std::move(c2); - - UNIT_ASSERT_VALUES_EQUAL(0, c2.size()); - UNIT_ASSERT_VALUES_EQUAL(4, c3.size()); - } - } - - Y_UNIT_TEST(pqueue1) { - TPriorityQueue, TLess> q; - - q.push(42); - q.push(101); - q.push(69); - UNIT_ASSERT(q.top() == 101); - - q.pop(); - UNIT_ASSERT(q.top() == 69); - - q.pop(); - UNIT_ASSERT(q.top() == 42); - - q.pop(); - UNIT_ASSERT(q.empty()); - } - - Y_UNIT_TEST(pqueue2) { - using TPQueue = TPriorityQueue, TLess>; - TPQueue q; - - { - TPQueue qq; - - qq.push(42); - qq.push(101); - qq.push(69); - - qq.swap(q); - } - - UNIT_ASSERT(q.top() == 101); - - q.pop(); - UNIT_ASSERT(q.top() == 69); - - q.pop(); - UNIT_ASSERT(q.top() == 42); - - q.pop(); - UNIT_ASSERT(q.empty()); - } - - Y_UNIT_TEST(pqueue3) { - TPriorityQueue, TLess> q; - - q.push(42); - q.push(101); - q.push(69); - q.clear(); - - UNIT_ASSERT(q.empty()); - } - - Y_UNIT_TEST(pqueue4) { - TDeque c; - c.push_back(42); - c.push_back(101); - c.push_back(69); - - TPriorityQueue, TLess> q(TLess(), std::move(c)); - - UNIT_ASSERT(c.empty()); - - UNIT_ASSERT_EQUAL(q.size(), 3); - - UNIT_ASSERT(q.top() == 101); - - q.pop(); - UNIT_ASSERT(q.top() == 69); - - q.pop(); - UNIT_ASSERT(q.top() == 42); - - q.pop(); - UNIT_ASSERT(q.empty()); - } - - Y_UNIT_TEST(queue1) { - TQueue> q; - - q.push(42); - q.push(101); - q.push(69); - UNIT_ASSERT(q.front() == 42); - - q.pop(); - UNIT_ASSERT(q.front() == 101); - - q.pop(); - UNIT_ASSERT(q.front() == 69); - - q.pop(); - UNIT_ASSERT(q.empty()); - } - - Y_UNIT_TEST(queue2) { - using TQueueType = TQueue; - TQueueType q; - - { - TQueueType qq; - - qq.push(42); - qq.push(101); - qq.push(69); - - qq.swap(q); - } - - UNIT_ASSERT(q.front() == 42); - - q.pop(); - UNIT_ASSERT(q.front() == 101); - - q.pop(); - UNIT_ASSERT(q.front() == 69); - - q.pop(); - UNIT_ASSERT(q.empty()); - } - - Y_UNIT_TEST(queue3) { - using TQueueType = TQueue; - TQueueType q; - - q.push(42); - q.push(101); - q.push(69); - q.clear(); - - UNIT_ASSERT(q.empty()); - } -} diff --git a/util/system/atexit.cpp b/util/system/atexit.cpp index 47d872635f..fb311566b1 100644 --- a/util/system/atexit.cpp +++ b/util/system/atexit.cpp @@ -3,10 +3,10 @@ #include "spinlock.h" #include "thread.h" +#include #include #include #include -#include #include #include @@ -40,7 +40,7 @@ namespace { auto guard = Guard(Lock_); - while (Items_) { + while (!Items_.empty()) { auto c = Items_.top(); Y_ASSERT(c); @@ -73,7 +73,7 @@ namespace { TAdaptiveLock Lock_; std::atomic FinishStarted_; TDeque Store_; - TPriorityQueue, TCmp> Items_; + std::priority_queue, TCmp> Items_; }; static TAdaptiveLock atExitLock; diff --git a/util/ysaveload.h b/util/ysaveload.h index 3629859f6b..55d7fd5bf2 100644 --- a/util/ysaveload.h +++ b/util/ysaveload.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -604,24 +605,24 @@ class TSerializer>: public TSetSerializer -class TSerializer> { +class TSerializer> { public: - static inline void Save(IOutputStream* rh, const TQueue& v) { - ::Save(rh, v.Container()); + static inline void Save(IOutputStream* rh, const std::queue& v) { + ::Save(rh, v.c); } - static inline void Load(IInputStream* in, TQueue& t) { - ::Load(in, t.Container()); + static inline void Load(IInputStream* in, std::queue& t) { + ::Load(in, t.c); } }; template -class TSerializer> { +class TSerializer> { public: - static inline void Save(IOutputStream* rh, const TPriorityQueue& v) { - ::Save(rh, v.Container()); + static inline void Save(IOutputStream* rh, const std::priority_queue& v) { + ::Save(rh, v.c); } - static inline void Load(IInputStream* in, TPriorityQueue& t) { - ::Load(in, t.Container()); + static inline void Load(IInputStream* in, std::priority_queue& t) { + ::Load(in, t.c); } };