Hi, I have seen this question appearing around the web, and I have now run into it. I have found a fix for it, but it doesnt seem tidy enough to be the correct way of handling it

Lets say we have 4 classes:

Code:
BaseGraph
DerivedGraph
BaseNode
DerivedNode
and:
Code:
baseGraph.someMethod(vector<BaseNode*> &list){...}
I want to however, pass a list of DerivedNodes as a reference to someMethod.

so I have this snippet:

Code:
vector<DeviredNode*> *nodeList;
nodeList = new vector<DerviedNode*>;
when I do
baseGraph.someMethod(nodeList);

I get:

non-const lvalue reference to type 'vector<class BaseNode *>' cannot bind to a value of unrelated type 'vector<class DerivedNode *>'
So I changed it from a reference to a pointer in someMethod (i.e the expected type is now a pointer) and it builds fine when I cast it:

Code:
baseGraph.someMethod(std::vector<graphDB::BaseNode*>*)nodeList)
but that looks disgusting and I would have thouht it was possible to be neater than that?