38
template <typename T>
struct foo
{
template <typename S>
friend struct foo<S>;
private:
// ...
};
하지만 내 컴파일러 (VC8)는 그것을 질식 : 내가 좋아하는 것
error C3857: 'foo<T>': multiple template parameter lists are not allowed
이
template struct foo
친구의 모든 가능한 인스턴스 생성을 가지고 모두
T
에 대해
foo<T>
입니다.
어떻게하면됩니까?
편집 :이
template <typename T>
struct foo
{
template <typename>
friend struct foo;
private:
// ...
};
컴파일 것 같다,하지만이 정확한지? 친구와 템플리트는 매우 부자연 스럽습니다.
감사합니다. 네 그것은 내가 원하는 것입니다. –
참조 섹션을 정의 된 표준에 게시 할 수 있습니까? –
14.5.3.3과 14.5.3.4의 C++ 03에서 C++ 11에서는 14.5.4의 Friends 섹션을 읽어야합니다 –