I have a following code:
std::map<size_t,Cell&> m_cellMap;
when Cell is defined as follows:
class Cell
{
public:
Cell(int x = 0,int y = 0) : m_x(x),m_y(y) { }
private:
int m_x;
int m_y;
/// class members and methods
};
I can`t compile below code:
Cell c;
m_cellMap[0] = c;
Getting the error : error C2101: '&' on constant
What is wrong ?How can it be fixed?
Thanks