diff --git a/libluna/include/luna/Slice.h b/libluna/include/luna/Slice.h index 66448f97..97ee1bc3 100644 --- a/libluna/include/luna/Slice.h +++ b/libluna/include/luna/Slice.h @@ -11,6 +11,10 @@ template class Slice { } + template Slice(const Slice& other) : m_data((T*)other.m_data), m_size(other.m_size) + { + } + const T* data() const { return m_data; @@ -46,6 +50,18 @@ template class Slice return m_data + m_size; } + const T& operator[](usize index) const + { + check(index < m_size); + return m_data[index]; + } + + T& operator[](usize index) + { + check(index < m_size); + return m_data[index]; + } + private: T* const m_data; const usize m_size;