Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to initialize 3 dimension vector with the size in C++

For example, if we initialize vector<vector<vector<double>>> f, the dimension in each direction is not specified. So, I am wondering, what command should we insert to make f have size of [3][4][5]. Do we use new or something else?

Thanks for helping me out!

like image 322
Cancan Avatar asked Oct 20 '13 23:10

Cancan


1 Answers

vector<vector<vector<double>>> f(3, vector<vector<double>>(4, vector<double>(5)));
like image 97
Igor Tandetnik Avatar answered Sep 24 '22 06:09

Igor Tandetnik