static const struct {
const char* name;
void (*func)(int);
} functions[] = {
{ "function1", [](int) { ... } },
{ "function2", [](int) { ... } },
...
};
However nothing in C++ stops that array from being compile time initialized even if it is not constexpr.
Yes, it should. This would also allow lambdas to be used as function argument template parameters somewhat.
However nothing in C++ stops that array from being compile time initialized even if it is not constexpr.