From d8829e7714d14e506dbccdc53d09528c74aae333 Mon Sep 17 00:00:00 2001 From: gabime Date: Fri, 1 Sep 2023 16:21:22 +0300 Subject: [PATCH] Added [[nodiscard]] qualifiers to circular_q --- include/spdlog/details/circular_q.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/spdlog/details/circular_q.h b/include/spdlog/details/circular_q.h index fda452ee..863f0ddc 100644 --- a/include/spdlog/details/circular_q.h +++ b/include/spdlog/details/circular_q.h @@ -61,20 +61,22 @@ public: } } - // Return reference to the front item. + // Return const reference to the front item. // If there are no elements in the container, the behavior is undefined. - const T &front() const + [[nodiscard]] const T &front() const { return v_[head_]; } - T &front() + // Return reference to the front item. + // If there are no elements in the container, the behavior is undefined. + [[nodiscard]] T &front() { return v_[head_]; } // Return number of elements actually stored - size_t size() const + [[nodiscard]] size_t size() const { if (tail_ >= head_) {