|
Boost Users : |
From: Forever Kid (foreverkid3_at_[hidden])
Date: 2007-03-28 23:46:15
What is the correct boost::bind syntax to use with a standard algorithm such as find_if with an array of weak_ptrs or shared_ptrs to an object such as a string?
My weak attempt to figure this out is below:
shared_ptr<string> sp1(new string("Play "));
shared_ptr<string> sp2(new string("with "));
shared_ptr<string> sp3(new string("C++!"));
vector<weak_ptr<string> > a_vector;
a_vector.push_back(weak_ptr<string>(sp1));
a_vector.push_back(weak_ptr<string>(sp2));
a_vector.push_back(weak_ptr<string>(sp3));
// What is the correct syntax here?
find_if(a_vector.begin(), a_vector.end(), (bind(&equal_to<string>(), _1))(string("Play "));
Thanks,
Graham
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/
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