Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++0x: Range overloads for standard algorithms?

Tags:

c++

c++11

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.

like image 314
wilhelmtell Avatar asked Oct 14 '22 17:10

wilhelmtell


1 Answers

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.

like image 71
dirkgently Avatar answered Oct 28 '22 10:10

dirkgently