Nested vector holding user-defined class, won't compile

This code won't compile. It actually doesn't give me any problems until "board.push_back (row);", at which time it gives me a very long and complicated compiler error. Can somebody please tell me what I'm doing wrong?

std::vector< std::vector<ChexTile> > makeBoard()
{
std::vector< std::vector<ChexTile> > board;

int r;
for (r = 0; r < 8; r++)
{
std::vector<ChexTile> row;
board.push_back (row);
}


return board;
}
Update - I changed all the "ChexTile" to "ChexTile*", and that worked. I would still like to know why the above code doesn't compile, though. I don't have a no-argument constructor defined for ChexTile... could that have something to do with it?
Objects stored in a vector need to be default constructable and assignable.

http://www.sgi.com/tech/stl/Container.html
Topic archived. No new replies allowed.