Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #91298

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

From "Alf P. Steinbach" <alf.p.steinbach@gmail.com>
Newsgroups comp.lang.c++
Subject Re: How to convert a pointer inside a vector back to an iterator ?
Date 2023-08-18 20:02 +0200
Organization A noiseless patient Spider
Message-ID <ubobnt$blc2$1@dont-email.me> (permalink)
References <ubnljr$89ne$1@dont-email.me>

Show all headers | View raw


On 2023-08-18 1:45 PM, Bonita Montero wrote:
> 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.

Don't know about "fully optimized away".

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


- Alf

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to convert a pointer inside a vector back to an iterator ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-08-18 13:45 +0200
  Re: How to convert a pointer inside a vector back to an iterator ? "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2023-08-18 20:02 +0200
    Re: How to convert a pointer inside a vector back to an iterator ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-08-18 22:05 +0200

csiph-web