N
Noah Roberts
template < typename V >
class Outer
{
public:
template < typename T >
class Inner
{
private:
template <class> friend class Inner;
};
typedef Inner<V> Test;
Test test() { return Test(); }
};
int main()
{
Outer<int> outer;
Outer<int>::Test t = outer.test();
}
1>c:\documents and settings\nroberts\my documents\visual studio
2005\projects\playground\playground\playground.cpp(17) : error C3855:
'Outer<V>::Inner': template parameter 'T' is incompatible with the
declaration
This compiles so long as Outer is not a template. I'm uncertain of
templated friend syntax. How do I change the friend statement to
reflect the change to Outer from basic class to template? Tried the
following rejected attempts:
template <class> friend typename Outer<V>::Inner;
template <class> friend class typename Outer<V>::Inner;
thanks.
class Outer
{
public:
template < typename T >
class Inner
{
private:
template <class> friend class Inner;
};
typedef Inner<V> Test;
Test test() { return Test(); }
};
int main()
{
Outer<int> outer;
Outer<int>::Test t = outer.test();
}
1>c:\documents and settings\nroberts\my documents\visual studio
2005\projects\playground\playground\playground.cpp(17) : error C3855:
'Outer<V>::Inner': template parameter 'T' is incompatible with the
declaration
This compiles so long as Outer is not a template. I'm uncertain of
templated friend syntax. How do I change the friend statement to
reflect the change to Outer from basic class to template? Tried the
following rejected attempts:
template <class> friend typename Outer<V>::Inner;
template <class> friend class typename Outer<V>::Inner;
thanks.