How to separarte lvalue parameter from rvalue?
realhet
real_het at hotmail.com
Mon Sep 14 11:02:49 UTC 2026
On Monday, 14 September 2026 at 10:51:38 UTC, realhet wrote:
> Hi! I try to make the easiest syntax for manipulating bits.
Update: This way I it works, but I think I'm abusing it.
```d
auto asBits(D)(ref D data)
{
static if(__traits(compiles, data = data)) return
BitsRefSlice!D(&data, 0, D.sizeof*8);
else return BitsValSlice!D(data, 0, D.sizeof*8);
}
auto asBits(D)(D data)
=> BitsValSlice!D(data, 0, D.sizeof*8);
```
Somebody please tell me what's the best practice for this.
More information about the Digitalmars-d-learn
mailing list