Question about iterator_traits<>::pointer questions

  • Thread starter Johannes Schaub (litb)
  • Start date
J

Johannes Schaub (litb)

I wonder what the heck iterator_traits<>::pointer is good for? The Standard
says it should be the type of "it->". What's that!? When is "pointer" ever
useful in an algorithm?
 
H

Howard Hinnant

I wonder what the heck iterator_traits<>::pointer is good for? The Standard
says it should be the type of "it->". What's that!? When is "pointer" ever
useful in an algorithm?

A non-built-in pointer is useful for creating a proxy-pointer in
process-shared memory. So making pointer generic helps generic code
work correctly whether it is dealing with built-in pointers or proxy
pointers (into shared memory). Iterator adaptors for example will
need to query an iterator's pointer type so that they can write their
own operator->().

-Howard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top