struct defined in friend class as argument

Hello all,

I am trying to implement an iterator to a BST class, but I am having trouble with a private function of the iterator class which should have a struct as its argument - specifically, a struct defined in the BST class (called BSTNode).

Here's the declaration inside the iterator class, which I have declared as a friend of the BST class.

 
  void addKeysToVec(struct BST<KeyType, ValueType>::BSTNode *node);


This doesn't seem to work. The compiler reads it as
 
  void addKeysToVec(void)


and I get this error

2244: 'BST<KeyType,ValueType>::Iterator::addKeysToVec' : unable to match function definition to an existing declaration

What would be the correct syntax to do this?

Thanks :)

I believe you just need to replace struct with typename in that case, but I haven't double checked.

EDIT: I think I am not understanding the situation you describe, could you post sample code of your setup?
Last edited on
Thanks a lot!
It worked :)
Topic archived. No new replies allowed.