|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-03-25 07:42:06
From: "Asger Alstrup Nielsen" <alstrup_at_[hidden]>
> 1) LL is trying to solve the wrong problem
Let's consider a concrete example.
[1]
template<class T> class greater_than
{
public:
explicit greater_than(T const & v): v_(v) {}
bool operator()(T const & w) const { return w > v_; }
private:
T v_;
};
std::find_if(v.begin(), v.end(), greater_than<int>(5));
[2]
std::find_if(v.begin(), v.end(), boost::bind(std::greater<int>(), _1, 5));
[3]
std::find_if(v.begin(), v.end(), _1 > 5);
Which one do you prefer?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk