I have such code which works well:
#include <algorithm>
#include <iostream>
char x[11]= "ABCDEFGHIJ";
char y[11];
struct F {
char operator () (char c) const
{ return c+1; }
};
int main()
{
std::transform(x, x+10, y, F());
y[10] = 0; std::cout <<y <<std::endl;
}
But if I change it to this style:
#include <algorithm>
#include <iostream>
char x[11]= "ABCDEFGHIJ";
char y[11];
int main()
{
struct F {
char operator () (char c) const
{ return c+1; }
};
std::transform(x, x+10, y, F());
y[10] = 0; std::cout <<y <<std::endl;
}
It will not compile, saying:
error: no matching function for call to ‘transform(char [11], char*, char [11], main()::F)’
What's wrong?
gcc version is 4.4, which does not recognize lambda expressions.