I have such code which works well:
#include
#include
char x[11]= \"ABCDEFGHIJ\";
char y[11];
struct F {
char operator ()
g++ 4.5.1 compiles your code (with -std=c++0x
option).
Your second code sample is ill-formed in C++031 but valid in C++0x
std::transform
is
template < class InputIterator, class OutputIterator, class UnaryOperator >
OutputIterator transform ( InputIterator first1, InputIterator last1,
OutputIterator result, UnaryOperator op );
However g++ 4.4 doesn't support local types as template arguments (even with -std=c++0x
option] so you get an error.
1 : A local type, a type with no linkage, an unnamed type or a type compounded from any of these types shall not be used as a template-argument for a template type-parameter. (ISO C++03 §14.3.1.2)