diff --git a/src/include/counted.h b/src/include/counted.h index 0a6f12b..066b414 100644 --- a/src/include/counted.h +++ b/src/include/counted.h @@ -20,12 +20,19 @@ struct counted inline const T & operator [] (int i) const { return pointer[i]; } using iterator = offset_iterator; + using const_iterator = const_offset_iterator; /// Return an iterator to the beginning of the array inline iterator begin() { return iterator(pointer, sizeof(T)); } /// Return an iterator to the end of the array inline iterator end() { return offset_ptr(pointer, sizeof(T)*count); } + + /// Return an iterator to the beginning of the array + inline const_iterator begin() const { return const_iterator(pointer, sizeof(T)); } + + /// Return an iterator to the end of the array + inline const_iterator end() const { return offset_ptr(pointer, sizeof(T)*count); } }; /// Specialize for `void` which cannot be indexed or iterated