Hi,
Is there a reason that the STL does not provide functions to return an iterator into a container via an index?
For example, let's say I wanted to insert an element into a std::list
but at the nth position. It appears that I have to retrieve an iterator via something like begin()
and add n
to that iterator. I'm thinking it would be easier if I could just get an iterator at the nth position with something like, std::list::get_nth_iterator(n)
.
I suspect I have misunderstood the principles of the STL. Can anyone help explain?
Thanks BeeBand