
Andrey Semashev wrote:
After reading the standard and a few code samples on the net, this looks like an interesting but somewhat dangerous feature. There seem to be no way to specify a namespace for the literal operator, so name clashes are most possible. I could introduce a suffix operator to automatically convert a string literal to a basic_string_literal object, but would that be significantly better than traditional generator functions?
string_literal s1 = "abcd"s;
vs
string_literal s2 = str_literal("abcd");
Note that in the latter case I can specify namespace for the str_literal function while in the former case it's not possible.
It's not dangerous. The way I would do it is provide a macro for logging that appends a suffix to the passed string - perhaps "boost_logxx" etc, the operator itself can be in the boost::log namespace.