Using allSatisfy with template that takes multiple type arguments

David Nadlinger see at klickverbot.at
Mon Sep 26 12:55:28 PDT 2011


On 9/26/11 9:32 PM, Andrej Mitrovic wrote:
> alias TypeTuple!(int, float) MyTypes;
> template isCompatible(T)
> {
>      enum bool isCompatible = allSatisfy!(isImplicitlyConvertible!T, MyTypes);
> }

template PApply(alias Target, T...) {
   template PApply(U...) {
     alias Target!(T, U) PApply;
   }
}

…

enum isCompatible = allSatisfy!(PApply!(isImplicitlyConvertible, T), 
MyTypes);

David


More information about the Digitalmars-d-learn mailing list