Use of class template requires template argument list

I keep getting this error in my code, and searching online doesn't provide results because I have already done what they asked for in my code, but I still keep getting the error.

In my .h file:

Book operator+(const Book<T> &other) const;

And this code, which is also in my .h file, after the last };. Note, I am doing it this way because I was asked to for my assignment.

template <class T>
Book Book<T>::operator+(const Book<T> &other) const
{

.....

}

I don't understand why I keep getting this error.
Remember, you should be returning a Book<T> NOT a Book from your operator. Just plain Book will give you that error.
Book Book<T>::operator+(const Book<T> &other) const Which Book? Book<int>, Book<std::string>, Book<std::tuple<std::pair<std::unordered_map<std::string,std::future<int>>,std::vector<std::mt13337>>,std::function<int(int,int,int,int)>>>?

You need either tell return type explicitely: Book<T> Book<T>::operator+(const Book<T> &other) const or use trailing return type when Book would be in scope.
Last edited on
Oh Okay i see, silly error == Thanks.
Topic archived. No new replies allowed.