function template problem

Compiler is not accepting template functions under some conditions.
So I found a very simple example, copied straight out of the documentation:

template <class myType>
myType GetMax (myType a, myType b) {
return (a>b?a:b);
}

Compiler responds with
"error: expected unqualified id before 'template' "

I don't understand why. Does any one have an idea why this happens?

I'm using the XCode development environment on the Mac.
Thanks!
I found how to fix this example but not my original problem.

I inserted this C++ function into an extended objective C file (a ".mm" file which allows C++ functions). When I insert it within the "@implementation" section, it's rejected by the compiler. But when I move it above, outside that section, it is accepted. Also, when I place it in an include file, whether inside or outside of a class declaration, it is also accepted.

This fix does not apply to my original problem.
I'll need to prepare another example to illustrate my problem.
Topic archived. No new replies allowed.