C ++ 11 introduced new string literals for UTF-8, 16, and 32 with the prefixes u8 , u and u , but I need to hardcode what I want to use. I am looking for a way to choose which encoding I want to use at compile time (similar to how typedef works).
Custom string literals don't seem to help, since they work with strings of the specified encoding.
I saw in pre C ++ 11 code using a short macro such as L("string") to choose between "string" and L"string" , but personally I find it pretty ugly.
Can I carefully select the default type and encoding, or do I have to use the macro parameter?
Dryap source share