簡易ラムダ

山本隆の開発日誌 - C++でラムダ・クラス


こんな方法でラムダできたんですね

#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

class lambda {
    template <class T>
    friend binder1st<greater<T> > operator<(const lambda&, const T& value)
    {
        return bind1st(greater<T>(), value);
    }
};

int main()
{
    vector<int> v;
    find_if(v.begin(), v.end(), lambda() < 7);

    return 0;
}

比較ができるだけでもかなり便利なんじゃないだろうか