/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h: In function â:
fail.cc:27: instantiated from â
fail.cc:41: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:925: error: invalid initialization of reference of type â from expression of type â
The problem at the moment is that the function argument in the transform function is expecting a function that takes a double as an argument and you are passing it a function which takes a vector<double> as its argument, so it is complaining that the function (max in this case) cannot be initialized with a double e.g. x.begin()
So the question is, what did you intend to happen?