This week I learned you can evaluate the length of a constexpr
string at compile-time.
#include <cstring>
constexpr std::size_t len(const char *x)
{
return '\0' == *x ? 0 : 1 + len(++x);
}
int main()
{
constexpr const auto a = "foobar";
static_assert(len(a) == 6, "oh no!");
}