aboutsummaryrefslogtreecommitdiff
path: root/src/common/memory.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/memory.h')
-rw-r--r--src/common/memory.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/memory.h b/src/common/memory.h
index a02ac578..e90bd52c 100644
--- a/src/common/memory.h
+++ b/src/common/memory.h
@@ -145,6 +145,18 @@ class wasteful_vector {
used_(0) {
}
+ T& back() {
+ return a_[used_ - 1];
+ }
+
+ const T& back() const {
+ return a_[used_ - 1];
+ }
+
+ bool empty() const {
+ return used_ == 0;
+ }
+
void push_back(const T& new_element) {
if (used_ == allocated_)
Realloc(allocated_ * 2);