I have a template class Test, and I am trying to define the following function in a separate header file:
template<typename T>
T dtest(const int, std::map<int, Test<T> >& y);
but I get the following error:
‘Test’ was not declared in this scope
template argument 2 is invalid
template argument 4 is invalid
Given that you assert that the header that defines
Test<T>is included by the header that declaresdtest, I’m going to guess you have a circular include: TheTest<T>header also includes thedtestheader.