1
가능한 복제를 발행합니다
problem with template inheritanceGCC 템플릿은
이 코드는 GCC로 컴파일되지 않습니다 중 하나 Base
또는 Sub
템플릿 클래스가 아니었다면
template <typename T>
struct Base
{
public:
int x;
};
template <typename B>
struct Middle : public B
{
};
template <typename T>
struct Sub : public Middle<Base<T> >
{
public:
void F()
{
x=1; // error: ‘x’ was not declared in this scope
}
};
을 , 그것은 불평하지 않을 것이다. VC가 처리합니다.
왜?
[템플릿 상속 문제] 중복 (http://stackoverflow.com/questions/2982660/problem-with-template-inheritance) –