aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-01-17 02:23:57 -0800
committerChris Robinson <[email protected]>2019-01-17 02:23:57 -0800
commit40c6f74bb71fe6e963b8bf270b59e80e00a098b0 (patch)
treee4367c029fa70483417c49147ed9e0c8a232d14e
parent101be788e13774d56949b5aa7630f0bee21e32cb (diff)
Add front and back methods to FlexArray
-rw-r--r--common/almalloc.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/almalloc.h b/common/almalloc.h
index 166ac8c9..406c2d31 100644
--- a/common/almalloc.h
+++ b/common/almalloc.h
@@ -127,6 +127,12 @@ struct FlexArray {
T& operator[](size_t i) noexcept { return mArray[i]; }
const T& operator[](size_t i) const noexcept { return mArray[i]; }
+ T& front() noexcept { return mArray[0]; }
+ const T& front() const noexcept { return mArray[0]; }
+
+ T& back() noexcept { return mArray[mSize-1]; }
+ const T& back() const noexcept { return mArray[mSize-1]; }
+
T *begin() noexcept { return mArray; }
const T *begin() const noexcept { return mArray; }
const T *cbegin() const noexcept { return mArray; }