staticEqual

Checks two expression lists to be equal. ET1 and ET2 should be wrapped to StrictExpressionList.

Types are checked via is operator. Values are compared via == operator. Templates are checked via special inner template-member opEquals or via ($B stringof) conversion (if no one from pair does not define opEquals).

Members

Aliases

T1
alias T1 = ET1.expand
Undocumented in source.
T2
alias T2 = ET2.expand
Undocumented in source.

Manifest constants

staticEqual
enum staticEqual;
Undocumented in source.
staticEqual
enum staticEqual;
Undocumented in source.
staticEqual
enum staticEqual;
Undocumented in source.
staticEqual
enum staticEqual;
Undocumented in source.
staticEqual
enum staticEqual;
Undocumented in source.
staticEqual
enum staticEqual;
Undocumented in source.
staticEqual
enum staticEqual;
Undocumented in source.

Examples

Example

// trivial cases
static assert(staticEqual!(StrictExpressionList!(1, 2, 3), StrictExpressionList!(1, 2, 3)));
static assert(staticEqual!(StrictExpressionList!(int, float, 3), StrictExpressionList!(int, float, 3)));
static assert(!staticEqual!(StrictExpressionList!(int, float, 4), StrictExpressionList!(int, float, 3)));
static assert(!staticEqual!(StrictExpressionList!(void, float, 4), StrictExpressionList!(int, float, 4)));
static assert(!staticEqual!(StrictExpressionList!(1, 2, 3), StrictExpressionList!(1, void, 3)));
static assert(!staticEqual!(StrictExpressionList!(float), StrictExpressionList!()));
static assert(staticEqual!(StrictExpressionList!(), StrictExpressionList!()));

// compare templates
template Dummy(T) {
}
static assert(staticEqual!(StrictExpressionList!(Dummy!int), StrictExpressionList!(Dummy!int)));
static assert(!staticEqual!(StrictExpressionList!(Dummy!int), StrictExpressionList!(Dummy!float)));

// compare templates via opEquals
template DummyStrange(_T, U) {
    alias T = _T; // re-export to outside
    template opEquals(alias S) {
        static if(__traits(compiles, S.T)) enum opEquals = is(T == S.T);
        else enum opEquals = false;
    }
}
static assert(staticEqual!(StrictExpressionList!(DummyStrange!(int, float)), StrictExpressionList!(DummyStrange!(int, ubyte))));
static assert(!staticEqual!(StrictExpressionList!(DummyStrange!(int, float)), StrictExpressionList!(DummyStrange!(bool, float))));

Meta