Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ standard/de facto STL algorithm wrappers

Are there any standard/de facto standard (boost) wrappers around standard algorithms which work with containers defining begin and end. Let me show you what I mean with the code:

// instead of specifying begin and end
std::copy(vector.begin(), vector.end(), output);
// write as
xxx::copy(vector, output);

I know it can be written easily, but I am looking specifically for something ubiquitous. Thanks.

like image 445
Anycorn Avatar asked Feb 01 '10 19:02

Anycorn


2 Answers

There is an extension to the Boost Range library called RangeEx which contains range wrappers for all stl algorithms, plus some new ones.

It has recently been accepted into Boost and so it's not yet in the current "official" release (1.41). Until this changes, you can download the latest version from the Boost Vault.

Don't know if this will ever become part of the C++ standard, but the fact that it's in Boost means that it will be the de facto standard.

like image 88
Manuel Avatar answered Oct 21 '22 18:10

Manuel


The next standard will (hopefully!) amend this. In the meantime, take a look at Boost.Range and its various uses although I’m not aware of an interface to the standard algorithms.

like image 31
Konrad Rudolph Avatar answered Oct 21 '22 19:10

Konrad Rudolph