0

何らかの理由で、クラスでこの 2 次元ベクトルのサイズを変更しても機能しません。ご協力いただきありがとうございます!

..
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]«|

4

1 に答える 1