I run into trouble if I would create an array of objects like this:
SM sc[8]{{0},{1},{2},{3},{4},{5},{6},{7}};
The constructor for SM is defined as:
SM::SM(int);
Because in c++ Each member is copy-initialized from the corresponding initializer-clause.
is given, I have a unsolved problem.
I already read:
Move Constructors and Static Arrays
Initialization of member array objects avoiding move constructor
Move constructor is required even if it is not used. Why?
constexpr array of constexpr objects using move ctor
Yes, all the answers describing very well what is giong on with list initialization but I could not found an idea how to get a static array of objects now.
Is there any work around for that problem? Creating a array of pointers and do a runtime initialization with new or new@ operation requires a lot more runtime a memory space. It is a bit problematic because I am on a AVR 8 bit controller.
Aucun commentaire:
Enregistrer un commentaire