Compile-Time Size Checking of Enum Members of std.bitmanip.bitfields

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 19 03:49:28 PST 2015


On Monday, 19 January 2015 at 11:40:07 UTC, Per Nordlöw wrote:
> Typical deductions are
> - enums: E.max - E.min + 1 (this requires offsetting logic in

I guess a trait for this, say

enum bitsizeOf(E) = return bitsNeeded(E.max - E.min + 1);

is motivated aswell, if it doesn't already exists...

What's the name of `bitsNeeded` (binary Power) in Phobos?


More information about the Digitalmars-d-learn mailing list