hasElaborateSelfEquals

Indicates wether the type passed as template parameter has a custom opEquals function that allows self comparison.

This triat mostly allows compare objects, with a known derived type, in @nogc code.

template hasElaborateSelfEquals (
T
) {
enum bool hasElaborateSelfEquals;
enum bool hasElaborateSelfEquals;
enum bool hasElaborateSelfEquals;
}

Examples

1 struct Foo {}
2 struct Bar {bool opEquals(const(Bar)){return true;}}
3 struct Baz {bool opEquals(Foo){return true;}}
4 static assert(!hasElaborateSelfEquals!Foo);
5 static assert(hasElaborateSelfEquals!Bar);
6 static assert(!hasElaborateSelfEquals!Baz);

Meta