
David Abrahams wrote:
John Torjo <john.lists@torjo.com> writes:
You can also use the rtl (Ranges Template Library): (note: I'll rename the library, wince there's another one with the same name ;))
for( crange<container> r(cont); r; ++r) *r += 2;
p.s. no macros involved in the above statement ;) Best, John
That said, you do have have to name the container type. At the same
I guess not needing to name the container type will happen only for C++0x. But lot of time 'till then ;) But I'm quite happy with the crange<container> compromise so far, since you do know the container type, once you use it (it's its type, that is :D)
time, you don't have to name the element type ;-)
of course ;) the element type is deduced from the container type. For instance, if you want a constant range, just do: crange<const container> r(cont); //... etc Best, John