[xsd-users] how do I...?
Ray Lischner
rlischner at proteus-technologies.com
Sat May 19 17:35:39 EDT 2007
> (3) Define operator== for comparing books.
I often wonder whether Code Synthesis should generate this operator for us. Optional items would be equal if both were absent, or both were present and equal. Cardinality > 1 items would be equal using the equivalent logic of the std::equals algorithm. Items deriving from fundamental types would be equal if the values were equal. Complex types would be equal if all their members were equal.
I've often found myself wishing for an auto-generated operator== when writing unit tests. At other times, I've managed to get by writing operator== manually, but always, my definition has been memberwise comparison for equality.
One of my co-workers assumed that Code Synthesis generated operator==, wrote her code with that assumption, and asked me for help when her code did not compile.
--
Ray Lischner, Proteus Technologies
More information about the xsd-users
mailing list