I am trying to write a small game with a tiled gameplay area. I have a vector of Tile objects - vector<Tile> area_tiles; - and I'm trying to add Tile objects to this vector like so:
Tile t(); // initialize new tile object area_tiles.push_back(t); // and add it to vector
This is the way I have added objects to vectors in previous projects and it has always seemed to work (perhaps due to blind luck?), until now. When I try to compile, I get this error:
error: no matching function for call to `std::vector<Tile, std::allocator<Tile> >::push_back(Tile (&)())'
I am a rank beginner with C++ and have absolutely no idea what is wrong, and I'm not experienced enough to understand what the error message is trying to tell me. I am sure the root of the problem is painfully obvious to anyone who has a clue, if someone could enlighten me?