On Friday, 7 August 2015 at 11:45:22 UTC, Nordlöw wrote:
Can somebody please explain and help out with variadic version of `isInstanceOf`?

Here's a step forward:

/**
Returns true if $(D T) is an instance of the template $(D T) with template
   parameters $(D Ps).
*/
enum bool isInstanceOf(alias S, T, Ps...) = is(T == S!Ps);

///
unittest
{
    struct SortedRange(Range, alias pred = "a < b")
    {
    }
    alias R = int[];
    alias SR = SortedRange!(R, "a < b");
    static assert(isInstanceOf!(SortedRange, SR, R, "a < b"));
}


1.
This, however, requires *all* the template parameters to be given. What I need now is a syntax to check that, in this case, *only* the second template argument `pred` matches. How do I do that?


2.
Note also that this solution doesn't understand that "a<b" and "a < b" are semantically equivalent. Forcing usage of `binaryFun` is a temporary solution. Is there a better solution?

Reply via email to