mixin template can't contain statements: workaround?
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Mar 15 06:29:18 PDT 2015
On Sun, 15 Mar 2015 13:28:33 +0000, ketmar wrote:
> template Foo(int a, string b) {
> import std.format : format;
> enum Foo = q{
> {
> import std.conv : to; return %2$s+to!string(%1$s);
> }
> }.format(a, b.stringof);
> }
>
> positional args, syntax highlighting, usage like `mixin(Foo!(42,
> "z"));`.
> maybe this will help.
ah, that `+`... ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150315/843e0def/attachment.sig>
More information about the Digitalmars-d-learn
mailing list