default '==' on structs
spir
denis.spir at gmail.com
Wed Feb 2 06:55:53 PST 2011
Hello,
What are the default semantics for '==' on structs?
I ask this because I was forced to write opEquals on a struct to get expected
behaviour. This struct is basically:
struct Lexeme {
string tag;
string slice;
Ordinal index;
}
Equal Lexeme's compare unequal using default '=='. When I add:
const bool opEquals (ref const(Lexeme) l) {
return (
this.tag == l.tag
&& this.slice == l.slice
&& this.index == l.index
);
}
then all works fine. What do I miss?
Denis
--
_________________
vita es estrany
spir.wikidot.com
More information about the Digitalmars-d-learn
mailing list