"Peter Dimov" <pdimov@mmltd.net> writes:
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 ) );
And then there's the minor detail that you're not allowed to take the address of standard library (member) functions... to be technically portable and correct, you need to write a wrapper, e.g. struct resize_vector_bool { template <class V, class N> void operator()(V& v, N n) const { v.resize(n); } }; and then you can go back to using two arguments: std::for_each( vec.begin(), vec.end() , boost::bind( resize_vector_bool(), _1, 10)); [unless we repealed that restriction in the committee while I wasn't looking] -- Dave Abrahams Boost Consulting www.boost-consulting.com