Reputation: 1113
Is there any way to get the index of an element from a pointer to the element? To be specific, what I need is the index (or iterator) to the element preceding or following the one I point. I know that when using vectors you can easily do the arithmetics but in a deque it is not so easy.
I have to use deque. Vectors are not an option.
Upvotes: 1
Views: 1687
Reputation: 19981
I believe the answer is no. But why not use iterators rather than pointers throughout?
Upvotes: 1