Boost logo

Boost Users :

From: Thaddeus Olczyk (doctlo-boost_at_[hidden])
Date: 2005-07-26 03:11:30


This piece of sample code demonstrates my problem quite well:

#include <boost/lambda/lambda.hpp>
#include <vector>
#include <string>
#include <iostream>

using boost::lambda::_1;

class A
{
  std::string s;
public:
  A(std::string sIn):s(sIn){}
  void print_A()
  {
    std::cout<<"A="<<s<<std::endl;
  }
};

int main()
{
std::string in;
std::vector<A *> alist;
while(in!="end")
{
   in="";
   std::getline(std::cin,in);
   alist.push_back(new A(in));
}
std::for_each(alist.begin(),alist.end(),
          _1->print_A()); // This is line 30
return 1;
}

----
Using g++ ( 3.??) and the latest boost, I get this error:
main.cpp: In function `int main()':
main.cpp:30: error: base operand of `->' has non-pointer type `const
boost::lambda::lambda_functor<boost::lambda::placeholder<1> >' 
Can anyone explain how to fix this?
Thanks
--
Thad 

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