I'm wondering how to intialize a N element std::array of a struct.
Example:
struct SomeStruct {
uint32_t * const entry1;
uint16_t * const entry2;
uint16_t * const entry3;
};
Initialization is possible by:
static const std::array<SomeStruct , 2> arr
{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
// nullptr just for example, would be addresses of real variables in the project
But this is not exactly what I need because the following statement works as well without any warning or something else, and therefore leaves elements default initilized.
static const std::array<SomeStruct , 2> arr
{nullptr, nullptr, nullptr, nullptr};
What I need is a strong check of the compiler whether all elements are initialized, in a syntax something like that:
static const std::array<SomeStruct , 2> arr
{{nullptr, nullptr, nullptr}, {nullptr, nullptr, nullptr}};
Is it possible to force C++ to check that all elements of the aggragte type to be initialized?
Tank you!