C++: Compile Error for Template Assignment Operator Overloading

c++

Solution

You need to put the template parameter in the return type:

template <typename T>  
StdVector<T> & StdVector<T>::operator=(const StdVector &v)
{  
    return *this;
}

Problem

I keep getting the error "use of class template requires template argument list" when I compile the following code in VC++6. What is wrong with it? ``` template <class T> class StdVector{ public: StdVector & operator=(const StdVector &v); }; template <typename T> StdVector & StdVector<T>::operator=(const StdVector &v){ return *this; } ```

Original source