
On 29.11.2011 17:09, Robert Jones wrote:
In this code (fabricated) sequence, ages_by_bind compiles, but ages_by_lambda does not.
I believe this is because the lambda version does not publish result_type to its resultant functors, since the increased generality of lambda makes this difficult or impossible to do.
Is there any way I can get round this, as it currently makes the lambda/transformed combination completely unusable AFAICS. Visual Studio 2010 SP1 (with boost from trunk) compiles this code. I suppose 1.48 will be ok too. BTW, why using bind or even lambda? There is a more simpler way:
#include <boost/range/iterator_range_core.hpp> #include <boost/range/adaptor/map.hpp> std::vector<int> ages(const std::map<std::string, int>& people) { using boost::adaptors::map_values; return boost::copy_range<std::vector<int> >(people | map_values); }