Obtain container type from (its) iterator type in C++ (STL)

I don’t think this would be possible. On some STL libraries you actually have a vector iterator as a pointer type, i.e. std::vector<T>::iterator is a T* so I can’t think of any way you could get back to the container type from that.

Leave a Comment