Template type deduction
Phil Lavoie
maidenphil at hotmail.com
Sun Jan 20 08:05:13 PST 2013
On Sunday, 20 January 2013 at 15:59:45 UTC, Andrej Mitrovic wrote:
> On 1/20/13, Phil Lavoie <maidenphil at hotmail.com> wrote:
>> Imagine you have something like this:
>>
>> struct MyParamType( T1, T2 ) { ... }
>>
>> and then a compound:
>>
>> struct MyCoumpound( T ) if( isMyParamType!T ) { ... }
>
> Use isInstanceOf in std.traits:
>
> struct MyCoumpound( T ) if( isInstanceOf!(MyParamType, T) ) {
> ... }
>
> On 1/20/13, Philippe Sigaud <philippe.sigaud at gmail.com> wrote:
>> is(T _ : MyParamType!U, U...)
>> ( '_' just to tell someone reading the code this part is not
>> used)
>
> This won't be necessary in the next release thanks to a pull by
> Kenji,
> you will be able to use:
> is(T : MyParamType!U, U...)
Nice, I am glad to learn it's in the stdlib.
More information about the Digitalmars-d-learn
mailing list