I moved out the methods implementation from my class and caught the following error:
Use of class template requires template argument list
for a method which doesn't require any template type at all… (for other methods everything is okay)
Class
template<class T>
class MutableQueue
{
public:
bool empty() const;
const T& front() const;
void push(const T& element);
T pop();
private:
queue<T> queue;
mutable boost::mutex mutex;
boost::condition condition;
};
Wrong implementation
template<> //template<class T> also incorrect
bool MutableQueue::empty() const
{
scoped_lock lock(mutex);
return queue.empty();
}
It should be:
template<class T>
bool MutableQueue<T>::empty() const
{
scoped_lock lock(mutex);
return queue.empty();
}
And if your code is that short, just inline it, as you can't separate the implementation and header of a template class anyway.