Instantiate!(Template, args) in Phobos?

Nick Treleaven via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 25 03:16:59 PDT 2016


On Friday, 22 April 2016 at 19:09:40 UTC, David Nadlinger wrote:
> From std.meta:
>
> ---
> /*
>  * Instantiates the given template with the given list of 
> parameters.
>  *
>  * Used to work around syntactic limitations of D with regard 
> to instantiating
>  * a template from an alias sequence (e.g. T[0]!(...) is not 
> valid) or a template
>  * returning another template (e.g. Foo!(Bar)!(Baz) is not 
> allowed).
>  */
> // TODO: Consider publicly exposing this, maybe even if only 
> for better
> // understandability of error messages.
> alias Instantiate(alias Template, Params...) = Template!Params;

Ah, maybe I'd even seen this in passing and forgot. Good point 
about aliasSeq template elements, let's make this public.


More information about the Digitalmars-d-learn mailing list