What does “operator = must be a non-static member” mean?

Exactly what it says: operator overloads must be member functions. (declared inside the class)

template<class T>
void list<T>::operator=(const list<T>& rhs)
{
    ...
}

Also, it’s probably a good idea to return the LHS from = so you can chain it (like a = b = c) – so make it
list<T>& list<T>::operator=....

Leave a Comment