My compiler is unhappy with the way I implement my template methods. It gives tons of "undefined type T" type error messages for these implementations.
This is my first method, it is implemented outside the class block:
class VectorConvertor { public: // ... template <class T> static void ReverseVectorElements(std::vector<T> & Vector); // ... }; template <class T> void VectorConvertor::ReverseVectorElements(std::vector<T> & Vector) { std::vector<T>::size_type size = Vector.size(); T swap; for (std::vector<T>::size_type i=0; i<size/2; i++) { swap = Vector.at(i); Vector.at(i) = Vector.at(size-1-i); Vector.at(size-1-i) = swap; } }
Another is that; This time the method is implemented inside the class:
class ElementaryMath { public:
Is there something wrong with my code, or is it just a problem with the compiler itself?
IDE and compiler: Visual Studio 2010
source share