Помогите понять как правильно записать следующее:
template <typename T>
class A
{
public:
template <typename U>
class B
{
public:
static int foo;
};
};
template <typename T, typename U>
void bar()
{
A<T>::B<U>::foo = 5;
}
int main()
{
bar<int, char>();
return 0;
}
Ругается на строке:
A<T>::B<U>::foo = 5;
main.cpp: In function ‘void bar()’:
main.cpp:17:11: error: expected primary-expression before ‘>’ token
main.cpp:17:12: error: ‘::foo’ has not been declared
main.cpp: In function ‘void bar() [with T = int, U = char]’:
main.cpp:22:17: instantiated from here
main.cpp:17:2: error: dependent-name ‘A<T>::B’ is parsed as a non-type, but instantiation yields a type
main.cpp:17:2: note: say ‘typename A<T>::B’ if a type is meant