To provide mutable and constant random access iterators for the dummy_array class shown in the previous section, add the following members to the class:
- An iterator class template, which is parameterized with the type of elements and the size of the array. The class must have the following public typedefs that define standard synonyms:
template <typename T, size_t const Size> class dummy_array_iterator { public: typedef dummy_array_iterator self_type; typedef T value_type; typedef T& reference; typedef T* pointer; typedef std::random_access_iterator_tag iterator_category; typedef ptrdiff_t difference_type; };
- Private members for the iterator class: a pointer to the array data and a current index into the array:
private: ...