If you need/want a non-macro solution there is one template trick that can help. You can have a function signature that looks like this:
template<int len>
void store_string( char const (&str)[len] ) { store_string_internal( str,len); }
template<int len>
void store_string( char (&str)[len] ) { static_assert( false ); }
The first form accepts strings literals and calls the target function. The second form prevents non-const character arrays from being passed. And yeah, don't offer a char const*
version.
This doesn't guarantee that the string is a string literal, but the one syntax needed to bypass it is extremely rare (I've never used it).
Otherwise the macro version from iammilind is nice.