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

后端 未结 2 1740
轮回少年
轮回少年 2020-12-25 08:19

For example, if we initialize vector>> f, the dimension in each direction is not specified. So, I am wondering, what com

2条回答
  •  感动是毒
    2020-12-25 09:10

    std::vector>> f(3, std::vector>(4, std::vector(5,0.0)));
    

    For anyone who wants it without namespace std. Also the values in this f[3][4][5] are initialised to 0.0 which might be useful.

提交回复
热议问题