I'm trying to implement a container in C++ that uses a flat array to store the data but iterates over that data in pairs. Now I could easily change the implementation such that the container holds a vector of std::pair
however I want to iterate through pairs starting at element 0 or at element 1.
To illustrate what I want to achieve, if my underlying array looks like: 1,2,3,4,5,6,7,8
I want to define two iterators, one which returns the pairs: (1,2), (3,4), (5,6), (7,8) and the second iterator to return the pairs: (2,3), (4,5), (6,7)
is this possible to do while still allowing the elements of the iterator to be references of the underlying array?