First: I am doing maintenance on legacy code. This used to work (and still does) in a different code base.
I have a method in a class defined as : getAllArrayPtrs(vector<someObject*> &apList); Essentially, I am calling the function with a reference to the vector.
I call it where I have defined:
vector<someObject*> apl;
It is called by
pIndexed->getAllArrayPtrs(apl)
Visual Studio 2008 errors:
1>.\VariableDlg.cpp(452) : error C2664: 'hCattrVarIndex::getAllArrayPtrs' : cannot convert parameter 1 from 'std::vector<_Ty>' to 'std::vector<_Ty> &'
1> with
1> [
1> _Ty=hCitemArray *
1> ]
1> and
1> [
1> _Ty=ptr2hCitemBase_t
1> ]
Does anybody have any idea what it could be complaining about?
I screwed up in the copying of my functions:
definition: getAllArrayPtrs(vector<someObject*> &apList);
vector is declared as vector<someObject*> ArrayPtrList;
The function was originally called as
pIndexed->getAllArrayPtrs(ArrayPtrList)
and I got
1>.\VariableDlg.cpp(452) : error C2664: 'hCattrVarIndex::getAllArrayPtrs' : cannot convert parameter 1 from 'std::vector<_Ty>' to 'std::vector<_Ty> &'
1> with
1> [
1> _Ty=hCitemArray *
1> ]
1> and
1> [
1> _Ty=ptr2hCitemBase_t
1> ]
so I declared a reference pointer
vector<someObject*> &apl = ArrayPtrList;
and get the same thing with
pIndexed->getAllArrayPtrs(apl)
vector<hCitemBase*> is not the same as vector<hCitemArray*>. You can't pass a reference or pointer of one to a function expecting the other.
As I said to beginning, the someObject thing you describe is not the same type in both cases.
Is hCitemBase a base class of hCitemArray? If so, you need to traverse the vector and pass each element, one at a time. And you must have a function that accepts hCitemBase* as a parameter.
Bingo! That evidently changed and I didn't notice it when I merged the code. Thank you very much! I needed another set of eyes. I looked at that over and over and I think my brain did an autocorrect or something. Thanks again.