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

前端 未结 4 461
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:38

    This doesn't use boost::assign but does what you need:

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

    This creates a vector containing 10 vectors of int, each containing 10 ints.

提交回复
热议问题