I need to perform a check on a constexpr array, but can't figure out how to pass the array into the check function.
#include <cstdlib>
constexpr int is[2] = {23, 42};
void inline check(const int (&elems)[2])
{
static_assert(elems[0] == 23, "Does not work");
}
void bar()
{
static_assert (is[0] == 23, "Works");
check(is);
}
Is there a way to pass the array into the check function without loosing the constexpr property?
int.constevalmight be another solution in a year or so.