default '==' on structs

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Feb 2 08:49:37 PST 2011


What is Ordinal defined as? If it's a uint, I get the expected results:

alias uint Ordinal;

struct Lexeme {
   string tag;
   string slice;
   Ordinal index;
}

void main()
{
    auto lex1 = Lexeme("a","b",1);
    auto lex2 = Lexeme("a","b",1);

    assert(lex1 == lex2);
    assert(lex1 == Lexeme("a","b",1));
}

Can't say much more without knowing what your app does though.


More information about the Digitalmars-d-learn mailing list