Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-01-30 14:58:59


gast128 wrote:
> Dear all,
>
> this new boost bind logical operators is a great enhancement for
> readability of bind constructions. However I have not found out yet
> how to deal with e.g. built in types:
>
> std::vector<int> vec;
> std::list<int> lst;
>
> //copy_if does not exist in std, I know.
> std::copy_if(vec.begin(), vec.end(), std::back_inserter(lst), ...);
>
> this ... must now boost::bind(std::equal_to<int>(), _1, nNumber),
> which is quite unreadable, but no such thing like boost::bind::_1 ==
> nNumber (like boost::lambda)?

No, this unfortunately doesn't work. '_1' is a built-in type on quite a
number of compilers (and it can change back and forth between releases as
problems with precompiled headers are discovered), so operator== can't be
overloaded for it. That's why I opted to not include the feature.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net