Any way to initialize a unique_ptr vector?
You cannot go from the initializer list because the elements
. §8.5.4 [dcl.init.list] / p5:
A type object
is constructed from list initializer as if the implementation had allocated an array of
elements of type
, where N is the number of elements in the initializer list. Each element of this array is initialized with a corresponding element in the initializer list and an Object is
created to indicate that it is an array.
You can only copy a copy, but you cannot copy
as it only moves.
You will need to use
etc. to fill the vector after you create it.
source to share