|
Boost Users : |
From: Jim Lear (jim.lear_at_[hidden])
Date: 2004-12-15 11:05:12
Daryle Walker wrote:
>int const a[] = { 1, 2, 3, 4 };
>int const * p = &a[0];
>
>assert( a[p] == 1 );
>
>Hopefully you know that the "a[p]" expression is nonsensical in C++ (or C).
>The library containers and iterators are (mostly) supposed to act like
>built-in arrays and pointers. So the dereferencing semantics of STL is kept
>as close as possible, but no closer, to built-in operations. Note that "p"
>already has enough information to utilize the first element without
>involving "a".
>
>
Yes, you are right, the container[iterator] doesn't make sense. I'm just
longing for the "for (i in map) print i,map[i];" simplicity of awk and
other languages.
-- Jim Lear
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net