Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Static vector of array

I would like to have a 2D static vector that can be extended in one direction. A static vector of array sounded right to me:

struct A
{
    public:
        static std::vector<std::array<float, 3> > theTable;
};

I tried to access it from main with:

A::theTable.push_back({0.0, 0.0, 0.0});

But I get "no matching function for call to std::vector<std::array<float, 3ul> >::push_back(<brace-enclosed initializer list>)"

How can I declare this vector of array and then use if properly from anywhere else?

like image 510
Shinagan Avatar asked Nov 18 '25 08:11

Shinagan


1 Answers

it looks like you have not defined theTable


struct A
{
    public:
        static std::vector<std::array<float, 3> > theTable;
};
std::vector<std::array<float, 3> > A::theTable; //define 
like image 139
kiviak Avatar answered Nov 19 '25 21:11

kiviak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!