Boost logo

Boost Users :

From: Alexander Shyrokov (shirokov_at_[hidden])
Date: 2006-09-13 15:31:50


Thanks Peter,

But how exactly do I specify _1? I have the same error if I do not
specify any name space (as it is shown in the example)

boost::_1 is not defined
boost::bind::_1 generates "fatal error C1001: INTERNAL COMPILER ERROR"

I do not know which error I like the best :)

This is the code:

#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;
}

Thanks.

Peter Dimov wrote:
> Alexander Shyrokov wrote:
>> I want to call a member function with a parameter from within an
>> algorithm.
>>
>> http://boost.org/libs/bind/bind.html#with_algorithms gives an example:
>>
>> void animation::advance(int ms);
>> std::vector<animation> anims;
>> std::for_each(anims.begin(), anims.end(),
>> boost::bind(&animation::advance, _1, ms));
>>
>> I am using boost::lambda:: before _1. I get an error error C2825:
>> 'F::result_type': cannot form a qualified name
>>
>> I am using MS VC7.1 and boost_1_33_1
>>
>> Any ideas why this does not work? Thanks.
>
> In 1.33, you can't use boost::bind with Lambda's placeholders. Either use
> Bind's ::_1 placeholder, or use boost::lambda::bind.
>
> In 1.35, the code will work even with Lambda's placeholder.
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users

-- 
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