So I have a class Board header as followed:
class Board
{
std::vector<std::vector<char>> _board;
uint _rows;
uint _cols;
public:
Board();
}
And I have this default constructor:
Board::Board()
{
_rows = 0;
_cols = 0;
_board.push_back(vector<char>(1, '_'));
}
And I just don't understand the syntax of this line of code:
_board.push_back(vector<char>(1, '_'));
I mean, it does it's job: it adds a '_' at the end of the first row as it should. But from what I've read about the method push_back() I don't understand why it's not just
_board.push_back('_');
PS: push_back() signature is:
void push_back (const value_type& val);
EDIT: The message error I get when using board.push_back(''); is:
error: no matching member function for call to 'push_back'