It is not only cumbersome, but also prevents the output of the template:
std::vector<int> a; someFunction(a);
An alternative (in C ++ 11) are template aliases:
template<typename T> using sometype = std::vector<T>; template<typename T> void someFunction(sometype<T> &myArg ); std::vector<int> a; someFunction(a);
You can also use macros, except that macros are never the correct answer.
#define sometype(T) std::vector<T> template<typename T> void someFunction( sometype(T) &myArg);
In addition, I believe your definition of sometype is not valid for pre-C ++ 11. It should not have this name:
template<typename T> struct type{ typedef std::vector<T> sometype; };
I think C ++ 11 modifies the rule to allow it, but some C ++ 03 compilers were unable to correctly diagnose the problem.
bames53
source share