Merge pull request #21 from vikramrajkumar/phoenix

Make fc::reflector<ENUM>::to_string work with C++11 strongly typed enumerations
This commit is contained in:
Nikolai Mushegian 2014-04-25 16:19:39 -04:00
commit 6b84b990b3

View file

@ -132,6 +132,14 @@ template<> struct reflector<ENUM> { \
}\
return nullptr; \
} \
static const char* to_string(ENUM elem) { \
switch( elem ) { \
BOOST_PP_SEQ_FOR_EACH( FC_REFLECT_ENUM_TO_STRING, ENUM, FIELDS ) \
default: \
fc::throw_bad_enum_cast( BOOST_PP_STRINGIZE(elem), BOOST_PP_STRINGIZE(ENUM) ); \
}\
return nullptr; \
} \
static ENUM from_string( const char* s ) { \
BOOST_PP_SEQ_FOR_EACH( FC_REFLECT_ENUM_FROM_STRING, ENUM, FIELDS ) \
fc::throw_bad_enum_cast( s, BOOST_PP_STRINGIZE(ENUM) ); \