
Frank Laub wrote:
If you have parse() and operator<<, then I guess adding operator>> would be logical.
Hrm, yes, but it's hard to write a templated operator>>. Currently I'm able to template the whole category of enumeration types by just having an overload for enum_base<T>. In the case of the operator>>, I can't output an enum_base<T>, it needs to be a T. So my question is, how do I write operator>> without making it overly generic?
In one of your previous messages you said that you have a template <typename base> struct safe_enum : base; and the macro: BOOST_ENUM(Boolean, (False) (True) ) is expanded to: class Boolean_base { ... }; typedef safe_enum<Boolean_base> Boolean; If this is still the case, then why shouldn't this template <typename base> istream& operator>>(istream &, safe_enum<base> &) { ... } work?
OK, in order to support the stringtable version, I now allow the user to specify what the datatype of the value portion should be. This makes the enum_base extermely generic. So now it's: BOOST_ENUM_VALUES(VirtualKey, size_t, (Space)(0x20) ... )
Sounds great! Any plans to request a review?