Template-Parameterized Variadic isInstaceOf
"Nordlöw" via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Aug 7 07:13:18 PDT 2015
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 try at isSortedRange:
enum bool isSortedRange(T, alias pred = "a < b") = is(T ==
SortedRange!(Args[0], pred), Args...);
unittest
{
alias R = int[];
enum pred = "a < b";
static assert(isSortedRange!(SortedRange!(R, pred),
pred));
}
but it fails. This simplified case
enum bool isSortedRange(T, alias pred = "a < b") = is(T ==
SortedRange!Args, Args...);
works.
How do check that the second template argument to the instance of
SortedRange matches `pred`?
More information about the Digitalmars-d-learn
mailing list