boost bind logical operators question
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)? Wkr, me
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.
Peter Dimov
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.
Ok thx. Maybe I write an adapter one day myself, for now I am too distracted with normal work. Wkr, me
participants (2)
-
gast128
-
Peter Dimov