Manipulating Bits of Any Value Type

Stanislav Blinov stanislav.blinov at gmail.com
Sun Jan 26 15:27:57 PST 2014


On Sunday, 26 January 2014 at 20:56:29 UTC, Nordlöw wrote:

> My idea to make `getBit` work on all types that have value 
> semantics.

All of them? Arbitrary structs too? floating point types? Static 
arrays? Might I ask... why do you need this sort of thing? :)

> That's why I need the cast (I think). Is there a traits to 
> check if a type has value semantics or not?

The closest would be std.traits.hasIndirections.

> Also is there a trait to check if a type supports a specific 
> operation such as bitwise and `&`? I could always use 
> `__traits(compiles, ...)` but standardization is good.

No there isn't.


More information about the Digitalmars-d-learn mailing list