using enums for flags

Simen Kjærås simen.kjaras at gmail.com
Wed Jan 25 10:56:26 PST 2012


On Wed, 25 Jan 2012 03:22:03 +0100, Trass3r <un at known.com> wrote:

> Does it really make sense to allow bitwise operations on different enums?

Maybe. Certainly sometimes, but those could just as easily use casts.


> There should at least be some way to get this straight without having to  
> resort to a heap of code like in C++:  
> http://www.artima.com/cppsource/safelabels.html

Well, it may be a heap of code, but it's a lot less than what you linked.
Example attached. It's WTFPL or freer, so feel free to use it as you wish.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flags.d
Type: application/octet-stream
Size: 5110 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120125/a50e4020/attachment-0001.obj>


More information about the Digitalmars-d mailing list