Compilation errors when trying to use range adaptors with C++11 lambdas

When trying to compile the following:
std::vector<int> v;
v | boost::adaptors::transformed([] (int x) { return x; });
I get a bunch of compile errors. If I replace the lambda with a function
defined normally, it works.
Am I doing something wrong, or is this a bug/missing feature/something?
I'm compiling with GCC 4.6.1 (though 4.7.1 has the same problem) and
have Boost 1.49.
The output and full program are attached. The main part (dropping the
"instantiated from..."s) of the first error is:
boost/utility/result_of.hpp:82:8: error: no class template named
‘result’ in ‘struct main()::

Hi Evan,
2012/6/20 Evan Driscoll
When trying to compile the following:
std::vector<int> v; v | boost::adaptors::transformed([] (int x) { return x; });
I get a bunch of compile errors. If I replace the lambda with a function defined normally, it works.
You must use #define BOOST_RESULT_OF_USE_DECLTYPE C++11 lambda can't apply non decltype-base result_of.
======================== Akira Takahashi mailto:faithandbrave@gmail.com https://sites.google.com/site/faithandbrave/about/en
participants (2)
-
Akira Takahashi
-
Evan Driscoll