www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Bitfields?

reply Martin <a b.c> writes:
Are there any C-like bitfields in D?

Yes - How can I use them?
No - What could be used in their stead?
Dec 30 2016
next sibling parent reply Marc =?UTF-8?B?U2Now7x0eg==?= <schuetzm gmx.net> writes:
On Friday, 30 December 2016 at 13:45:23 UTC, Martin wrote:
 Are there any C-like bitfields in D?

 Yes - How can I use them?
 No - What could be used in their stead?
Not built-in, but in the standard library: https://dlang.org/phobos/std_bitmanip.html#.bitfields
Dec 30 2016
parent Martin <a b.c> writes:
On Friday, 30 December 2016 at 14:06:06 UTC, Marc Sch├╝tz wrote:
 On Friday, 30 December 2016 at 13:45:23 UTC, Martin wrote:
 Are there any C-like bitfields in D?

 Yes - How can I use them?
 No - What could be used in their stead?
Not built-in, but in the standard library: https://dlang.org/phobos/std_bitmanip.html#.bitfields
Thanks, will take a look now.
Dec 30 2016
prev sibling parent jkpl <jkpl bower2000.de> writes:
On Friday, 30 December 2016 at 13:45:23 UTC, Martin wrote:
 Are there any C-like bitfields in D?

 Yes - How can I use them?
 No - What could be used in their stead?
If you're okay with dependencies and if you use DUB there's this very decent wrapper called EnumSet: - https://code.dlang.org/packages/iz - https://github.com/BBasile/iz/blob/master/import/iz/enumset.d#L226
Dec 31 2016