On Tue, Feb 26, 2019 at 10:56:37PM +0000, Victor Porton via Digitalmars-d-learn 
wrote:
[...]
> After fixing the error you pointed me, it does not work too:
> 
> mixin ProviderParams!("S", ((int, "x"), (float, "y")));

Try this:

        mixin ProviderParams!("S", int, "x", float, "y");


> Also: Can I nevertheless group arguments?

Template argument lists auto-expand, so even if you could group
arguments, they make no functional difference.  If you truly need to
distinguish between groups of arguments, you have to pack them into a
non-autoexpanding group, for example:

        template Group(Args...) {
                // Note: NOT eponymous.
                alias contents = Args;
        }

        mixin ProviderParams!("S", Group!(int, "x"), Group!(float, "y"));

Keep in mind, however, that inside ProviderParams you will need to
explicitly access .contents. For example:

        mixin template ProviderParams(Args...) {
                static foreach (arg; Args[1 .. $]) {{
                        alias type = arg.contents[0];
                        alias name = arg.contents[1];
                }}
        }


T

-- 
Prosperity breeds contempt, and poverty breeds consent. -- Suck.com

Reply via email to