
21 Apr
2004
21 Apr
'04
9:04 a.m.
Thorsten Ottosen wrote:
with some collection traits:
for( iterator_of< T >::type i = begin( c ); i != end( c ); ++i ) *i +=2;
This is better than a standard for-loop from a maintenance perspective, but not from a usability perspective. It's just as much typing, or more. You still have to specify the container type. And if the container type is dependent, you'll need to insert a "typename" before iterator_of< T
::type. It also requires you to have an understanding of iterators and half-open sequences, something that is not intuitive to people new to the STL way.
-- Eric Niebler Boost Consulting www.boost-consulting.com