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

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -