Within a class or function template, it is necessary label (with the
"typename" keyword) any name-dependent type - bytes.com

typename BST<TypeT>::BSTNode * BST<TypeT>::BSTNode::Insert(TypeT const& v)
{
//Implementation
}

I was creating a BST and LinkedList with private node classes and I ran into this error:
"expected constructor, destructor, or type conversion before '*'"

There are 3 root causes:
* referencing "BST" instead of "BST<TypeT>"
* referencing "BST<TypeT>::BSTNode *" as a return value instead of "typename BST<TypeT>::BSTNode *"
* attempting to use the standard ".h" / ".cpp" separation in the first place rather than just garbling everything together

By AJ ONeal

If you loved this and want more like it, sign up!


Did I make your day?
Buy me a coffeeBuy me a coffee  

(you can learn about the bigger picture I'm working towards on my patreon page )



Published

2009-11-12



Buy me a coffeeBuy me a coffee


  73% of Goal Reached


Want more like this?