C++ - Static 2d vector not being set

178 views Asked by At

I have a static 2-dimensional vector that I'm trying to use in a constructor. The code is as follows:

in Stage.h

#pragma once

class Stage
{
public:
    Stage();
    virtual ~Stage();    
private:
    typedef std::vector<std::vector<int>> tileMap;
    static tileMap testStageTiles;
};

in Stage.cpp

Stage::Stage()
{
    std::cout << Stage::testStageTiles.size() << std::endl;
}

Stage::~Stage()
{
}

Stage::tileMap Stage::testStageTiles = {
    {1,1,1,1,1,1},
    {1,0,0,0,0,1},
    {1,0,0,0,0,1},
    {1,0,0,0,0,1},
    {1,0,0,0,0,1},
    {1,1,1,1,1,1}
};

Instantiating the class with Stage _stage;

But, it always prints out as 0, just wondering why I can't get this vector instantiated?

0

There are 0 answers