On Wednesday, 16 June 2021 at 05:48:21 UTC, VitaliiY wrote:
On Tuesday, 15 June 2021 at 12:39:40 UTC, Dennis wrote:
On Tuesday, 15 June 2021 at 12:18:26 UTC, VitaliiY wrote:
[...]
```D
enum string ADDBITS(string a, string b) = `
{
bitbuffer = (bitbuffer<<(`~a~`))|((`~b~`)&((1<<`~a~`)-1));
numbits += (`~a~`);
mixin(STOREBITS);
}`;
// on use: ADDBITS(varA, varB) becomes
mixin(ADDBITS!("varA", "varB"));
`
[...]
Thank you, Dennis. I tried with this kind of mixin, but a, b -
are type of 'int so it's confusing to use them as mixin
arguments.
Use the
[.stringof](https://dlang.org/spec/property.html#stringofhttps://dlang.org/spec/property.html#stringof) property. That should do it.