I'm trying to use boost::adaptors::transformed by providing a c++0x lambda to the adaptor.
The following code does not compile. I'm using g++ 4.6.2 with boost 1.48.
#include <iostream>
#include <vector>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
using namespace std;
namespace br = boost::range;
namespace badpt = boost::adaptors;
int main()
{
vector<int> a = {0,3,1,};
vector<int> b = {100,200,300,400};
auto my_ftor = [&b](int r)->int{return b[r];};
cout<<*br::max_element(a|badpt::transformed(my_ftor))<<endl;
}
Any ideas on what I'm doing wrong here?