13 Sep
2006
13 Sep
'06
8:52 p.m.
Thanks! That solved the problem. Thanks a lot. Peter Dimov wrote:
#include <vector> #include <algorithm> #include <boost/bind.hpp>
int main(int argc, char **argv) { typedef std::vector<std::vector<bool> > T2Dimensional; T2Dimensional vec; std::for_each(vec.begin(),vec.end() ,boost::bind(&std::vector<bool>::resize,_1,10)); return 0; }
Your code is fine, sort of. The problem is that vector<>::resize takes two arguments. The second one has a default, but this information is lost when the pointer to member &std::vector<bool>::resize is taken. So you have to pass a value for it.
std::for_each(vec.begin(),vec.end() ,boost::bind( &std::vector<bool>::resize, _1, 10, false ) ); -- Regards, Alexander. http://sjcomp.com