Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One solution for being unable to move objects from initializerlist is to copy the objects instead. This can be done by iterating over the initializerlist and copying each object into a new container, such as a vector or list. Alternatively, if the objects in the initializerlist are move-only types, it may be necessary to modify the constructor of the class using the initializerlist to accept rvalue references, so that move operations can be performed.