diff options
author | Max Kellermann <max@duempel.org> | 2014-03-01 07:25:17 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-03-01 07:49:13 +0100 |
commit | 4ba7427fa0f4c8495df331829eb67b27be9c9078 (patch) | |
tree | d34390e68bcd7a26145ea308ea0ee842d637ba32 /src/util/WritableBuffer.hxx | |
parent | 9dc5335e3e4e07371cfae96eca2cb5b2a93c8dd2 (diff) |
util/{Const,Writable}Buffer: add operator[]
Diffstat (limited to 'src/util/WritableBuffer.hxx')
-rw-r--r-- | src/util/WritableBuffer.hxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util/WritableBuffer.hxx b/src/util/WritableBuffer.hxx index 64e6d0c62..d13f80867 100644 --- a/src/util/WritableBuffer.hxx +++ b/src/util/WritableBuffer.hxx @@ -145,6 +145,17 @@ struct WritableBuffer { constexpr const_iterator cend() const { return data + size; } + +#ifdef NDEBUG + constexpr +#endif + T &operator[](size_type i) const { +#ifndef NDEBUG + assert(i < size); +#endif + + return data[i]; + } }; #endif |