I have created a container class for which I need to create a bespoke iterator (not merely exposing the iterator of the container's internal data type).
I think the normal way of doing this is along the following lines:
This is fine but I find the container class becomes somewhat cluttered as the declaration of the iterator can be somewhat lengthy.
Is there any reason why the iterator could not be declared in the same header file as the Container class but not as a nested declaration in the Container class?