Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to convert a pointer inside a vector back to an iterator ?

22 views
Skip to first unread message

Bonita Montero

unread,
Aug 18, 2023, 7:45:19 AM8/18/23
to
How can I convert a pointer inside a vector back to an iterator
so that the operation is fully optimized away ? I try to use
iterators as most as possible to have iterator debugging, but
sometimes I've to work togehter with iterator debugging.

Alf P. Steinbach

unread,
Aug 18, 2023, 2:02:47 PM8/18/23
to
Don't know about "fully optimized away".

But otherwise, `v.begin() + (p - v.data())`.


- Alf

Bonita Montero

unread,
Aug 18, 2023, 4:05:28 PM8/18/23
to
If the pointer is inside a register that's optimized away and
the register is considered to be the iterator object afterwards.,


0 new messages