A spoiler warning: don't read this tip if you want to keep the topic of my next C++ newsletter as a surprise!
The C++03 standard defines a range as "a pair of iterators that designate the beginning and end of the computation". This seemingly trivial notion is going to change the way we use STL algorithm, containers and even built-in arrays, making our code simpler to read and write, safer and in some cases even more efficient.
The range library is already widely used among Boosters. A revised version thereof is now being reviewed before it gets integrated into the Working Paper of standard C++. Since the whole notion of ranges is so intuitive that I see no reason why it won't be incorporated into C++09.
Standard algorithms are specified in terms of iterators, which makes them somewhat clumsy to use. By combining two iterators into
one object, C++ programmers and library designers can achieve great benefits:
Find out how these benefits are accomplished in my next C++ newsletter.
Take advantage of special member promotions, everyday discounts, quick access to saved content, and more! Join Today.