c++ - Can UnaryOperator be a member function when std::transform is called -
c++ - Can UnaryOperator be a member function when std::transform is called -
based on std::transform
template < class inputiterator, class outputiterator, class unaryoperator > outputiterator transform ( inputiterator first1, inputiterator last1, outputiterator result, unaryoperator op );
can op
fellow member function? if so, how phone call it?
no (well, not directly). need utilize adaptor, either old std::mem_fun
(together bind1st
, iirc) or std::bind
/boost::bind
.
std::transform( xs.begin(), xs.end(), ys.begin(), std::bind(&class::member, &class_instance) );
c++ stl
Comments
Post a Comment