tags:

views:

507

answers:

2
std::sort(range(c));

as opposed to

std::sort(c.begin(), c.end();

Do you expect the next standard to provide range overloads for standard algorithms?

Boost's range iterators are something similar, and Bjarne Stroustrup's iseq()s mentioned in TC++PL3e are also the same idea. I have looked at the latest draft I could find but didn't see range overloads mentioned.

+4  A: 

The History page provides a partial answer.

There has to be a compelling need to add overloads to the std namespace. Note, this is a Library Issue. You can search the archives to find if anyone has previously raised a request to add these to the library. If there isn't any you can submit a defect report. The current language does not, in any way, stop you from writing your own wrappers. So, the question boils down to whether a lot of others will also want this as a standard library supported feature or not. But that ain't all. Any extension, even to the library, is not just a technical choice, but is also guided by numerous other geo-political issues. You have to have a certain number of votes to get this in.

Frankly, I'd love to see this get in. However, remember this in no way is a novel/core feature that the library can't do without. So, keep your fingers crossed.

dirkgently
I think readable and succinct code is no less essential and important than clear and succinct error messages for which concepts were voted in (a change in the language!). I think ranges will promote the use of the STL. I hope the people at the C++ Standards committee think the same.
wilhelmtell
Mandating a single overload in the standard is no easy job: It involves every compiler vendor to provide patches to their runtimes, libraries --> increased time to market --> standard either never gets accepted due to the delay or the next version is ready ... You get the drift
dirkgently
A: 

The range-based for loop is the only thing in the draft standard I could find that uses the Range concept. It seems natural to me that most of the standard algorithms could support Ranges, but there's no mention of it in the draft standard you linked.

Kristo
There are also iterators in chapter 23 based on the Range concept in TR2.
greyfade