diff options
author | David Robillard <d@drobilla.net> | 2023-09-22 12:35:23 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-09-23 00:17:27 -0400 |
commit | 9646fe7e21771bb43be3e91929de89d7bad0babb (patch) | |
tree | 39100725917c62d662064abc85081c616a7c81fb /include | |
parent | 14b81b5e34ecb92fed57b0ada55770e56d969ed8 (diff) | |
download | raul-9646fe7e21771bb43be3e91929de89d7bad0babb.tar.gz raul-9646fe7e21771bb43be3e91929de89d7bad0babb.tar.bz2 raul-9646fe7e21771bb43be3e91929de89d7bad0babb.zip |
Use nodiscard attribute
Diffstat (limited to 'include')
-rw-r--r-- | include/raul/RingBuffer.hpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/include/raul/RingBuffer.hpp b/include/raul/RingBuffer.hpp index a60fe4a..b6e3e01 100644 --- a/include/raul/RingBuffer.hpp +++ b/include/raul/RingBuffer.hpp @@ -57,19 +57,19 @@ public: } /// Return the number of bytes of space available for reading - uint32_t read_space() const + [[nodiscard]] uint32_t read_space() const { return read_space_internal(_read_head, _write_head); } /// Return the number of bytes of space available for writing - uint32_t write_space() const + [[nodiscard]] uint32_t write_space() const { return write_space_internal(_read_head, _write_head); } /// Return the capacity (i.e. total write space when empty) - uint32_t capacity() const { return _size - 1; } + [[nodiscard]] uint32_t capacity() const { return _size - 1; } /// Read from the RingBuffer without advancing the read head uint32_t peek(uint32_t size, void* dst) @@ -147,7 +147,7 @@ private: return size; } - uint32_t write_space_internal(uint32_t r, uint32_t w) const + [[nodiscard]] uint32_t write_space_internal(uint32_t r, uint32_t w) const { if (r == w) { return _size - 1; @@ -160,7 +160,7 @@ private: return (r - w) - 1; } - uint32_t read_space_internal(uint32_t r, uint32_t w) const + [[nodiscard]] uint32_t read_space_internal(uint32_t r, uint32_t w) const { if (r < w) { return w - r; |