From 5ef9259e64495408d45d10ee8392c67bf74b517e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 15 Apr 2019 13:24:39 -0400 Subject: [PATCH] common/threadsafe_queue: Apply nodiscard where applicable --- src/common/threadsafe_queue.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/threadsafe_queue.h b/src/common/threadsafe_queue.h index e714ba5b3a..7cf9492d07 100644 --- a/src/common/threadsafe_queue.h +++ b/src/common/threadsafe_queue.h @@ -25,15 +25,15 @@ public: delete read_ptr; } - std::size_t Size() const { + [[nodiscard]] std::size_t Size() const { return size.load(); } - bool Empty() const { + [[nodiscard]] bool Empty() const { return Size() == 0; } - T& Front() const { + [[nodiscard]] T& Front() const { return read_ptr->current; } @@ -123,15 +123,15 @@ private: template class MPSCQueue { public: - std::size_t Size() const { + [[nodiscard]] std::size_t Size() const { return spsc_queue.Size(); } - bool Empty() const { + [[nodiscard]] bool Empty() const { return spsc_queue.Empty(); } - T& Front() const { + [[nodiscard]] T& Front() const { return spsc_queue.Front(); }