For some reason, resizing this two dimensional vector in my class does not work. Thanks for your help!
..
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;
..
Some error messages:
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]«|
multi_array
is, by name, an array, not avector
– Bartek Banachewicz