Информация об изменениях

Сообщение Re: boost::lexical_cast: из std::string в enum от 12.11.2015 18:57

Изменено 12.11.2015 19:03 niXman

https://github.com/niXman/enum-gen

ENUM_GEN_DECLARE_ENUM(
   my_enum
   ,
   (one)
   (two)
   (three)
)

const std::string se = enum_cast(two);
my_enum ee = enum_cast<my_enum>(se.c_str());
assert(ee == two);
Re: boost::lexical_cast: из std::string в enum
https://github.com/niXman/enum-gen

ENUM_GEN_DECLARE_ENUM(
   my_enum
   ,
   (one)
   (two)
   (three)
)

const std::string se = enum_cast(two);
my_enum ee = enum_cast<my_enum>(se.c_str());
assert(ee == two);


если енумы уже существуют, сгенерить для них мета-инфу можно так:
ENUM_GEN_ADAPT_ENUM(
   my_enum
   ,
   (one)
   (two)
   (three)
)

сами енумы от этого не изменятся.