Boost logo

Boost Users :

From: Alexander Shyrokov (shirokov_at_[hidden])
Date: 2006-09-13 16:52:20


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

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