Add convenience macros for enabling Variant <-> enum conversions.
ecorm opened this issue · 1 comments
ecorm commented
Something like:
#define CPPWAMP_ENUM_CONVERSION(TEnum_) \
void convert(wamp::FromVariantConverter& conv, TEnum_& e) \
{ \
using IntegerType = std::underlying_type<TEnum_>::type; \
e = static_cast<TEnum_>(conv.variant().to<IntegerType>()); \
} \
\
void convert(wamp::ToVariantConverter& conv, TEnum_& e) \
{ \
using IntegerType = std::underlying_type<TEnum_>::type; \
conv(static_cast<IntegerType>(e)); \
} \
ecorm commented
Instead, make it so that CppWAMP converts enumerations to/from integers automatically, while allowing the user to specify a custom convert
function for their enum types.