D
David Rasmussen
Given an enum type E, how do I make, say, operator += work for that enum
type?
/David
type?
/David
* David Rasmussen said:Given an enum type E, how do I make, say, operator += work for that enum
type?
Alf said:Best to avoid enum types.
C++ is not Ada, as we have discussed before a few times... ;-)
But if you absolutely must,
E& operator += (E& lhs, E rhs )
{
lhs = static_cast<E>( lhs + rhs );
return lhs;
}
David said:Given an enum type E, how do I make, say, operator += work for that enum
type?
/David
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.