Usign boost::bind with a call to member function

Hello,
I would like to replace this trivial loop
for(size_t i=0; i

przemyslaw.sliwa@uk.bnpparibas.com wrote:
Hello,
I would like to replace this trivial loop
for(size_t i=0; i
event(domCcy, intersection[i])); } with a call to std::transform and boost::bind. The events object is actually a boost_shared_ptr<> of a certain type. domCcyEventPtrs and intersection are std::vector<> objects. Can this be done?
std::transform ( intersection.begin() , intersection.end() , std::back_inserter(domCcyEventPtrs) , boost::bind(&events_type::event, &events, domCcy, _1) ); depending on what domCcy is and how you want it passed you may need to wrap it in boost::ref or boost::cref. Also a more succinct approach would be to use the range library. Jeff
participants (2)
-
Jeff Flinn
-
przemyslaw.sliwa@uk.bnpparibas.com