C
Christopher
I have a few questions. My template class is getting very messy and I
have a need to make it more clear.
The first is how to change nested classes where the implementation is
embedded in the definition to a separate definition and
implementation. The other is, after doing the first, How can I keep
class Node hidden aside from using pimpl? I'd also like to keep the
concept of Iterator being specific to Tree, i.e Tree::Iterator and not
allow a user to declare Iterator by itself. The notion of class scope,
as it is in C#, would be nice here, but it is unavailable.
template <class T>
class Tree
{
class Node
{
T m_data
...
public:
...
T & GetData();
...
};
...
public:
...
class Iterator
{
Node * m_node;
};
...
};
have a need to make it more clear.
The first is how to change nested classes where the implementation is
embedded in the definition to a separate definition and
implementation. The other is, after doing the first, How can I keep
class Node hidden aside from using pimpl? I'd also like to keep the
concept of Iterator being specific to Tree, i.e Tree::Iterator and not
allow a user to declare Iterator by itself. The notion of class scope,
as it is in C#, would be nice here, but it is unavailable.
template <class T>
class Tree
{
class Node
{
T m_data
...
public:
...
T & GetData();
...
};
...
public:
...
class Iterator
{
Node * m_node;
};
...
};