In our sources we have often something like this:
static const int g_numbers[]{ 1, 2, 3, 4, 5};
static const struct
{
const int m_nID;
const char* const m_pszName;
}
g_collection[]
{
{ 1, "Max" },
{ 2, "Fabian" },
{ 3, "Martin" },
…
};
How to transform those compile-time arrays to modern C++? Using e.g. std::array?
If I understood it correctly, std::array needs a size as template argument.
Which way would you suggest to transform such code with minimum overhead (e.g. code generation) and unnecessary, redundant information?