vector - C++ push_back method -


i don't understand why error in definition of methode "add". here code:

enum colour {empty = 0, red, yellow};  class game{ public:    void add(size_t, colour const&);  private:    vector<vector<colour>> tab; };  void game:: add(size_t column, colour const& colour) { tab[0][column].push_back(colour); } 

if tab uninitialized cannot access index in

tab[0][column].push_back(colour);.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -