Y
yu_kuo
I got series warning when using write enum type to a ostream using
operator<<, like
in call to `std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>:perator<<(int) [with _CharT =
char, _Traits = std::char_traits<char>]'
A.cpp:60: warning: passing `NAME_ENUM' chooses `int' over `long int'
Compiler gcc 3.4.3
When deserialize from an istream, I have to first using an int, and
then cast to the enum type. And need check the range on the spot.
I do know I can overload operator<< and >> for enum type, but do that
for every enum type isn't too boring? I'm wondering a way to do it in
one strike, is there?
Regards,
Kevin
operator<<, like
in call to `std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>:perator<<(int) [with _CharT =
char, _Traits = std::char_traits<char>]'
A.cpp:60: warning: passing `NAME_ENUM' chooses `int' over `long int'
Compiler gcc 3.4.3
When deserialize from an istream, I have to first using an int, and
then cast to the enum type. And need check the range on the spot.
I do know I can overload operator<< and >> for enum type, but do that
for every enum type isn't too boring? I'm wondering a way to do it in
one strike, is there?
Regards,
Kevin