I have a class to wrap string literals and calculate the size at compile time.
The constructor looks like this:
template< std::size_t N >
Liter
There is a way to force a string literal argument: make a user defined literal operator. You can make the operator constexpr to get the size at compile time:
constexpr Literal operator "" _suffix(char const* str, size_t len) {
return Literal(chars, len);
}
I don't know of any compiler that implements this feature at this time.