I want to write a copy c'tor to my class which contains a list of shared ptrs like this:
std::vector<std::shared_ptr<Character>> board;
If I want he copy constructor to make copies of all of the Character
s, Is is enough in my copy c'tor to write the following:
Game::Game(const Game &other): dimensions(other.dimensions), board(dimensions.getRow()*dimensions.getCol()) {
int board_size= dimensions.getRow()*dimensions.getCol();
for (int i=0;i<board_size;++i)
{
this->board[i]=other.board[I]; //or *(this.board[I]=*other.board[I];
}
}
plus, should I write copy c'tor in Character class? Please Note I have 2 questions,