c++ easy way to convert macro variable to wchar string literal

c++, macros

Solution

You use an `L` prefix on the string literal to make a wchar string literal:

#define CAT(A, B)   A##B
#define WSTRING(A)  CAT(L, #A)

Problem

In the following example, I would like to remove the `std::wstring(std::widen(...))` part, but the '#' macro only returns a char string literal -- is there any way to accommodate a wchar? ``` #define FOO_MACRO(className)\ struct className##Factory : public OtherClass {\ // does some stuff here\ } className##Factory;\ someMap->add(std::wstring(std::widen(#className), className##Factory))) ``` How would I do the same thing using wchar?

Original source