Initializing a vector of vectors having a fixed size with boost assign

前端 未结 4 454
Happy的楠姐
Happy的楠姐 2020-12-04 10:10

Having a vector of vector with a fixed size,

vector > v(10);

I would like to initialize it so that it has in all e

4条回答
  •  眼角桃花
    2020-12-04 10:32

    You don't need to use boost for the required behaviour. The following creates a vector of 10 vectors, with each vector containing 10 ints with a value of 1:

    std::vector> v(10, std::vector(10, 1));
    

提交回复
热议问题