// Online C++ compiler to run C++ program online
#include <iostream>
template <typename T>
class Test
{
public:
using MyType = unsignedint;
private:
T t;
};
template <typename T>
void doSomething(Test<T> myTest, Test<T>::MyType mT)
{
}
int main() {
// Write C++ code here
std::cout << "Hello world!";
return 0;
}
presents this error:
1 2
/tmp/aIhavoWVkC.cpp:15:43: error: 'Test<T>::MyType' is not a type
15 | void doSomething(Test<T> myTest, Test<T>::MyType mT)
The code works if I refer to a particular template type (e.g. Test<string>::MyType). Is there no way to refer to a type declared in a class template (as opposed to the class instantiated from a particular template)?