resizing multidimensional vector

前端 未结 5 470
伪装坚强ぢ
伪装坚强ぢ 2020-12-31 17:39

How to resize multidimensional vector such as:

  vector  > > array; 

For example, I need arr

5条回答
  •  伪装坚强ぢ
    2020-12-31 18:06

    I would make a custom container containing a vector of vectors (of ... per dimension) and resize with resize-functions per dimension. This way you can put the invariant of equal size per dimension in one place. The actual resizing can then be done in a loop according to dimension.
    There will be a bit of work involved in making public what needs to be accessed (operator[],...)

提交回复
热议问题