Template substitution for function parameters
Nicholas Wilson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Sep 1 04:31:00 PDT 2017
On Friday, 1 September 2017 at 10:58:51 UTC, user1234 wrote:
> On Friday, 1 September 2017 at 10:15:09 UTC, Nicholas Wilson
> wrote:
>> So I have the following types
>> ...
>> i.e. it substitutes the template DevicePointer for the
>> template Buffer in Parameters!foo,
>> The templates can be assumed to not be nested templates, i.e.
>> DevicePointer!(DevicePointer!(float)) will never occur neither
>> will Buffer!(Buffer!(float) or any cross templates)
>
> Wow, this Question triggers an immediate headache...What about
> this ?
>
> import std.traits: Parameters;
> alias HostArgsOf(alias A) = AliasSeq!(Parameters!A[0],
> Parameters!A[1], Parameters!A[2]);
It will probably take the form
alias HostArgsOf(alias k) = staticMap!(something, Parameters!k);
I'm just not sure how to formulate the something.
More information about the Digitalmars-d-learn
mailing list