
nested class in class template
I've run into a problem that took me some time to resolve altougth it
is a trivial one. May be some one will benefit from this.
VC compiles but does not link code like this:
template < class T >
class A
{
public:
class B
{
public:
T& fb();
T m_t;
};
B m_b;
B& fa() { return m_b; }
Quote:
};
template < class T >
T& A<T>::B::fb()
{
return m_t;
Quote:
}
------------------------------------------------------------------
In order to make VC link the code fb should be defined inline as in:
template < class T >
class A
{
public:
class B
{
public:
T& fb() { return m_t; }
T m_t;
};
B m_b;
B& fa() { return m_b; }
Quote:
};