mixin template's alias parameter ... ignored ?
someone
someone at somewhere.com
Sun Jul 11 06:24:36 UTC 2021
On Sunday, 11 July 2021 at 05:54:48 UTC, Ali Çehreli wrote:
> The only way that I know is to take a string parameter and use
> it with a string mixin:
Yes, that I tried, but the structure has a lot of lines of codes
and so it is impractical and of course it will turn out difficult
to debug.
Since this seems to be a dead-end I did reshuffle some things
around:
```d
/// for illustration purposes only:
alias stringUTF08 = string; /// = immutable(char )[];
alias stringUTF16 = dstring; /// = immutable(dchar)[];
alias stringUTF32 = wstring; /// = immutable(wchar)[];
alias stringUGC08 = gudtUGC!(stringUTF08);
alias stringUGC16 = gudtUGC!(stringUTF16);
alias stringUGC32 = gudtUGC!(stringUTF32);
public struct gudtUGC(typeStringUTF) {
typeStringUTF whatever;
... lots of functions using typeStringUTF here
}
void main() {
version (useUTF08) { stringUGC08 lugcSequence3 =
stringUGC08(r"..."c); }
version (useUTF16) { stringUGC16 lugcSequence3 =
stringUGC16(r"..."d); }
version (useUTF32) { stringUGC32 lugcSequence3 =
stringUGC32(r"..."w); }
}
```
It works.
Thanks Ali :) !
More information about the Digitalmars-d-learn
mailing list