Martin Vermeer <[EMAIL PROTECTED]> writes: | On Sun, May 29, 2005 at 09:58:22PM +0300, Martin Vermeer wrote: >> On Sat, May 28, 2005 at 12:12:07AM +0200, Lars Gullik Bjønnes wrote: | >> > | +inline flags operator|(flags const f, flags const g) >> > | +{ >> > | + int const intf(static_cast<int>(f)); >> > | + int const intg(static_cast<int>(g)); >> > | + return static_cast<flags>(intf | intg); >> > | +} >> > >> > Is the temporary ints needed? >> > >> > >> > inline flags operator|(flags const f, flags const g) >> > { >> > return static_cast<flags>(f | g); >> > } >> > >> > should be enough. >> >> Yes, of course. Silly of me. > | No, silly of you, Lars :-)
I have been bitten by that one before... :-) but drop the explict tempraries and just use ( return static_cast<flags)(int(f) | int(g)); -- Lgb