Reputation: 153
I am trying to add an object in a vector of pointers:
vector<CCellDescr*> m_Data; // table contains(pointers to a cell)
void setCell(const CCellDescr& cell_Data)
{
m_Data.push_back( cell_Data);
}
I try with m_Data->push_back(cell_Data)
but it didn`t work. The error is:
Error 1 'void std::vector<_Ty>::push_back(CCellDescr *&&)' :
cannot convert parameter 1 from 'const CCellDescr' to 'CCellDescr *&&'
Upvotes: 0
Views: 68
Reputation: 6303
You have a vector of pointers, but you are trying to push a reference to it. Try m_Data.push_back(&cell_Data)
.
Upvotes: 2