I created a vector of vector of shared_ptr
class (_cells
).
class Goban
{
public:
Goban();
~Goban();
private:
vector<vector<shared_ptr<Cell>>> _cells;
};
I initialize like that :
Goban::Goban() : _cells(18, vector<shared_ptr<Cell>>(18, make_shared<Cell>()))
{
}
The problem is all pointers refer to the same pointer dynamically (If I understood correctly). So when I change an element in my class Cell using my vector, it changes all other elements.