summaryrefslogtreecommitdiff
path: root/context.h
diff options
context:
space:
mode:
Diffstat (limited to 'context.h')
-rw-r--r--context.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/context.h b/context.h
index a52d296..3ef2a01 100644
--- a/context.h
+++ b/context.h
@@ -192,8 +192,12 @@ public:
return n * sizeof(T);
};
- T &operator[](size_t i) {
+ T &at(size_t i) {
return m_data[i];
+ }
+
+ T &operator[](size_t i) {
+ return at(i);
};
T *start() {
@@ -210,6 +214,11 @@ public:
};
template<typename T2>
+ T2 &at_as(size_t i) {
+ return reinterpret_cast<T2>(at(i));
+ };
+
+ template<typename T2>
size_t size_as() {
return byte_size() / sizeof(T2);
};