出于某种原因,在我的课堂上调整这个二维向量的大小不起作用。谢谢你的帮助!
..
Map::Map(const unsigned int& w,
const unsigned int& h,
const unsigned int& s)
: width(w), height(h), size(s)
{
squares.resize(width);
for (unsigned int i = 0; i < width; ++i)
{
squares[i].resize(height); // error here
for (unsigned int j = 0; j < height; ++j)
{
squares[i][j] = Square(sf::Vector2f(i * size, j * size));
}
}
}
std::vector<std::vector<Square>> squares;
..
一些错误信息:
c:\mingw\bin..\lib\gcc\mingw32\4.6.2\include\c++\bits\stl_uninitialized.h|481| instanziiert von »static void std::__uninitialized_default_n_1< TrivialValueType>:: _uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = Square*, _Size = unsigned int, bool _TrivialValueType = false]«|
c:\mingw\bin..\lib\gcc\mingw32\4.6.2\include\c++\bits\stl_uninitialized.h|529| instanziiert von »void std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = Square*, _Size = unsigned int]«|