
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 << ' ']); }