Boost logo

Boost Users :

From: paulgrenyer (pjgrenyer_at_[hidden])
Date: 2003-09-03 04:28:36


Hi

MSVC 7.1, Windows 2000

I'm trying to get to grips with the boost lambda library. I've
managed to get the first example to work:

#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <cstdlib>
#include <list>
#include <algorithm>

int main()
{
        using namespace std;
        using namespace boost::lambda;
        
        list<int> v(10);
        for_each(v.begin(), v.end(), _1 = 12 );
        return EXIT_SUCCESS;
}

…but when I add the following line (also from the docs):

for_each( v.begin(), v.end(), cout << *_1 << '\n' );

I get the following errors:

error C2039: 'reference' : is not a member
of 'std::iterator_traits<int>'
error C2146: syntax error : missing ';' before identifier 'type'
error C2501: 'boost::lambda::detail::contentsof_type<A>::type' :
missing storage-class or type specifiers
error C2039: 'type' : is not a member
of 'boost::lambda::detail::contentsof_type<A>'
error C2146: syntax error : missing ';' before identifier 'type'

I've tried including some the other Lambda headers but this didn't
improve the situation.

Regards
Paul


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