?
Member functions only serve if the implementation can be more efficient (set :: find is more efficient than std :: find () in the set).
PS Oh, and if you want to avoid the ubiquitous calls .begin(), en .end(), use Boost Range Algorithms . Sweet syntactic sugar
Random pattern inspired by gain range:
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/pending/integer_range.hpp>
using namespace boost::adaptors;
static int mod7(int v)
{ return v % 7; }
int main()
{
std::vector<int> v;
boost::copy(
boost::make_integer_range(1,100) | transformed(mod7),
std::back_inserter(v));
boost::sort(v);
boost::copy(
v | reversed | uniqued,
std::ostream_iterator<int>(std::cout, ", "));
}
source
share