diff options
author | bunnei <bunneidev@gmail.com> | 2020-08-16 01:47:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-16 01:47:54 -0400 |
commit | db96034ea429cf0b0b5e2bac790392d9e2f50990 (patch) | |
tree | 9a1ed0bfc2d01d67d0f62383dbb2a1f4c9fb4eca /src/common/threadsafe_queue.h | |
parent | 404362e1b070960cdc2c600ca206c2b792d8a880 (diff) | |
parent | 1ee060ca0dfae7d0a1c830c7495f3125acf0ec7f (diff) |
Merge pull request #4528 from lioncash/discard
common: Make use of [[nodiscard]] where applicable
Diffstat (limited to 'src/common/threadsafe_queue.h')
-rw-r--r-- | src/common/threadsafe_queue.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common/threadsafe_queue.h b/src/common/threadsafe_queue.h index 8268bbd5c..a4647314a 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; } @@ -130,15 +130,15 @@ private: template <typename T> 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(); } |