jeudi 24 novembre 2016

Why doesn't C++11 provide placeholders as lambdas?

#include <vector>
#include <boost/lambda/lambda.hpp>

using boost::lambda::_1;
using namespace std;

int main()
{
    vector<int> coll{-1, 2, -2, 3, 5, 7};
    count_if(begin(coll), end(coll), _1 > 0 && _1 < 3);
}

The example above and this SO question show how elegant placeholders would be if the C++ standard library can provide them as boost has done.

My question is: Why doesn't C++11 provide placeholders as lambdas?

Aucun commentaire:

Enregistrer un commentaire