First of all I'd like to apologize if there's another question like this one and I didn't find it. I've been trying but since the problem is quite specific I couldn't find one.
Now, the problem. I have a Base class and a Derived class (say BNode and DNode ), and I have a std::vector of BNode*. I have also a function which receives a reference to a vector of these pointers. I'm having trouble when trying to pass a std::vector of pointers to derived objects as a parameter to this function:
class BNode
{
};
class DNode : public BNode
{
};
class Other
{
function(std::vector<BNode*>& inputVector) { }
}
When trying to pass a vector of pointers to the derived class, the error I'm receiving from VS is:
1> error C2664: 'Other::function' : cannot convert parameter 1 'std::vector<T>' to 'std::vector<T> &'
1> with
1> [
1> T=DNode *
1> ]
1> and
1> [
1> T=BNode *
1> ]
Thanks beforehand.