Suppose I have some struct/class:
#include <cstdio>
template <typename T>
struct MyClass
{
template <int U>
int foo() {
return U;
}
};
int main() {
MyClass<double> myClass;
int ret = myClass.foo<5>();
printf("%d\n", ret);
}
This works with no issues.
Why can't I create a templated function that creates an instance of MyClass and uses the templated foo() method?
template <typename T>
int bar() {
MyClass<T> myClass;
return myClass.foo<6>();
}