This is by far the most nice way to deal with Enum stringizing.
As for namespaces enum, you can try to declare using namespace within the implementation body before calling this macro. I’ve seen some usage like this.
namespace SomeNamespace;
{
enum class EExample
{
X,Y
}
}
within implementation body
{
using namespace SomeNamespace;
stringify(EExample);
}
In addition, one can always write double macro to make it better. This was after referring @MissingAFewHead templated function.
#define stringify(name) #name
#define EnumValStr(Enum, Val) EnumToString( (stringify(Enum)) , Val)