Question about iterator_traits<>::pointer questions

Discussion in 'C++' started by Johannes Schaub (litb), Sep 16, 2010.

  1. 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?
     
    Johannes Schaub (litb), Sep 16, 2010
    #1
    1. Advertising

  2. On Sep 15, 4:25 pm, "Johannes Schaub (litb)" <>
    wrote:
    > 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
     
    Howard Hinnant, Sep 16, 2010
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lieven

    iterator_traits

    Lieven, Dec 2, 2004, in forum: C++
    Replies:
    3
    Views:
    484
    Siemel Naran
    Dec 3, 2004
  2. chris
    Replies:
    8
    Views:
    522
    Tom Widmer
    Dec 10, 2004
  3. Jess
    Replies:
    3
    Views:
    666
    Zeppe
    Jun 28, 2007
  4. Ioannis Vranos

    typename iterator_traits::pointer

    Ioannis Vranos, Jan 24, 2008, in forum: C++
    Replies:
    10
    Views:
    722
    Ioannis Vranos
    Jan 25, 2008
  5. Replies:
    14
    Views:
    1,405
    Triple-DES
    Feb 12, 2008
Loading...

Share This Page