How to initialize a vector of class handles?

前端 未结 3 2001
渐次进展
渐次进展 2021-01-14 05:04

I have a handle-based class that I need to create a vector of. An easy method of doing this is to dynamically construct the vector in a for loop, but this causes mlint

3条回答
  •  逝去的感伤
    2021-01-14 05:50

    foo(10) = HandleClass();
    

    This will default fill foo(1) through foo(9).

    Note that this only works if HandleClass's constructor works with no input arguments (that is, it can be default-constructed).

提交回复
热议问题