This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Initializing an array by referencing the constructor

Tags: None
(comma "," separated)
spiderpacman
Registered Member
Posts
3
Karma
0
Hi!
I am trying to make an array of SparseMatrix<double> this way :
Code: Select all
const int N_Tot = 4+N_Max[0]+N_Max[1]+N_Max[2]+N_Max[3];
Eigen::SparseMatrix<double> mat[N_Tot]= {Eigen::SparseMatrix<double>(8*N_Slots,8*N_Slots)};


But the compiler keep telling me : error: variable-sized object 'mat' may not be initialized

I have strictly no idea why and I have no advantage creating a vector instead.

Could you help me please? Thanks

Theo
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
you should use a std::vector<Eigen::SparseMatrix<double> >.
spiderpacman
Registered Member
Posts
3
Karma
0
Thank you,
I finally found another solution less memory-consumming


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]