isEqualityComparable

Detects whether T is a comparable type. Basic types and structs and classes that implement opCmp are ordering comparable.

enum bool isEqualityComparable(T);

Examples

static assert(isOrderingComparable!int);
static assert(isOrderingComparable!string);

static struct Foo {}
static assert(!isOrderingComparable!Foo);

static struct Bar
{
    int a;
    auto opCmp(Bar b1) const { return a - b1.a; }
}

Bar b1 = Bar(5);
Bar b2 = Bar(7);
assert(isOrderingComparable!Bar && b2 > b1);

Meta