Lyes
Lyes

Reputation: 477

initialize a vector of vectors of arrays returns an error

i would like to initialize a vector of vectors of arrays like this

vector<vector<int[4]>> gri =  

{
    {{8,5,9,4},{9,1,5,9},{6,9,6,6}},
    {{7,4,6,1},{6,8,3,4},{1,1,9,0}},
    {{9,6,0,4},{0,4,8,2},{5,9,1,8}}
};

i'm novice in c++ but i think i'm doing right the error i'm getting is

array must be initialized with a brace-enclosed initialize

i can't identify the issue, despite i'm using brace-enclosed, can anyone tell me what's wrong in my code please.

Upvotes: 1

Views: 61

Answers (1)

Matthieu Brucher
Matthieu Brucher

Reputation: 22023

Use an array:

vector<vector<array<int,4>>>

You can't store int[4] in a vector directly.

Upvotes: 3

Related Questions