• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

Use a template of Type 'A' within 'A'

tatteredpotato

Diamond Member
Jul 23, 2006
3,934
0
76
For Example I tried:

class TreeNode
{
public:
vector<TreeNode> children;
etc.....
};

This gives me an error stating:

ISO C++ forbids declaration of vector with no type.

How would I go about doing this?

EDIT: For the record it's the same error as giving:

vector<sfkljwoisjdfks> children;

In other words it's not recognizing the TreeNode type within TreeNode.

EDIT 2: I'm a noob, I forgot the "using namespace std;"