
17 Sep
2010
17 Sep
'10
4:31 p.m.
Can this be done?
Thanks for help michi7x7's advice was correct, the code was just missing a '*'.
Below gives a couple ways you could achieve what you want: #include <boost/iterator/indirect_iterator.hpp> #include <boost/lambda/lambda.hpp> #include <boost/make_shared.hpp> #include <vector> int main() { std::vector<boost::shared_ptr<int> > tmp(5, boost::make_shared<int>(5)); std::for_each(tmp.begin(), tmp.end(), *boost::lambda::_1 = 0); std::fill(boost::make_indirect_iterator(tmp.begin()), boost::make_indirect_iterator(tmp.end()), 0); } HTH, Nate