iterating through members of bitfields
Nestor via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jan 20 04:04:07 PST 2017
On Friday, 20 January 2017 at 08:13:08 UTC, drug wrote:
> Something like that https://goo.gl/C4nOqw
> Because you generate code iterating over AliasSeq you can do
> almost everything you need - for example generate
> setters/getters.
Interesting site, I wouldn't implemente something like this in a
public server but sure it's useful.
Regarding the example, looks interesting though it raises s a few
doubts (forgive me if they sound silly):
What's UAP?
Where does one define the size for a field using AliasSeq, and in
this example, why does it take 1 bit if the size is not declared
anywhere? (also, why does it compile when the last field
terminates with a comma?)
alias Fields = AliasSeq!(
ushort, "field0",
ubyte, "field1",
uint, "field2",
ubyte, "field3",
bool, "field4",
bool, "field5",
bool, "field6",
ubyte, "field7",
);
Why does the switch apply to the remainder of the modulo
operation, does Fields contains indexes to types and names as if
it was an array?
More information about the Digitalmars-d-learn
mailing list