From a7f3c5aad244120afd965490d6dce8d131f01eda Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 12 Jan 2021 01:02:49 -0800 Subject: [PATCH] base: Remove begin() and end() from CircleBuf. These functions return iterators which are inconsistent with the usage model for this type. It should be accessed using the peek, push, and pop methods and not iterators. If you need a class with iterators which is oriented around accessing individual elements at a time, the CircularQueue type is likely a better choice. Change-Id: I9f37eab12e490b63d870d378a91f601dad353f25 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38998 Reviewed-by: Daniel Carvalho Reviewed-by: Andreas Sandberg Maintainer: Gabe Black Maintainer: Andreas Sandberg Tested-by: kokoro --- src/base/circlebuf.hh | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/base/circlebuf.hh b/src/base/circlebuf.hh index 0f1cea638..bcfa91a27 100644 --- a/src/base/circlebuf.hh +++ b/src/base/circlebuf.hh @@ -62,8 +62,6 @@ class CircleBuf public: using value_type = T; - using iterator = typename std::vector::iterator; - using const_iterator = typename std::vector::const_iterator; explicit CircleBuf(size_t size) : buffer(size), maxSize(size) {} @@ -71,15 +69,6 @@ class CircleBuf size_t size() const { return used; } size_t capacity() const { return maxSize; } - iterator begin() { return buffer.begin() + start % maxSize; } - const_iterator begin() const { return buffer.begin() + start % maxSize; } - iterator end() { return buffer.begin() + (start + used) % maxSize; } - const_iterator - end() const - { - return buffer.begin() + (start + used) % maxSize; - } - /** * Throw away any data in the buffer. */ -- 2.30.2