Boost logo

Boost Users :

From: Fei Liu (fei.liu_at_[hidden])
Date: 2007-09-25 10:31:58


The following small code snippet does not compile with boost 1.33.1.
What did I do wrong or the library is limited in what it can do?

g++ -fstrict-aliasing -fomit-frame-pointer -Wall -pedantic -ansi -g -O2
anytest.cpp -o anytest
anytest.cpp: In function ‘int main()’:
anytest.cpp:22: error: ‘const struct
boost::lambda::lambda_functor<boost::lambda::placeholder<1> >’ has no
member named ‘type’
gcc version 4.1.1 20060525 (Red Hat 4.1.1-1)

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#include <boost/any.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/if.hpp>

using namespace std;
using namespace boost::lambda;
using namespace boost;
using boost::any_cast;

int main(){
vector<any> a;
any val = 3;
a.push_back(val);
val = string("456");
a.push_back(val);

std::for_each(a.begin, a.end(), if_then(_1.type() == typeid(int))[cout
<< _1 << ' ']);
}


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