summaryrefslogtreecommitdiff
path: root/xsd/cxx/tree/tree-inline.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xsd/cxx/tree/tree-inline.cxx')
-rw-r--r--xsd/cxx/tree/tree-inline.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/xsd/cxx/tree/tree-inline.cxx b/xsd/cxx/tree/tree-inline.cxx
index e6ed756..500ee73 100644
--- a/xsd/cxx/tree/tree-inline.cxx
+++ b/xsd/cxx/tree/tree-inline.cxx
@@ -82,6 +82,28 @@ namespace CXX
<< " " << base_type << " (o, f, this)"
<< "{"
<< "}";
+
+ // Comparison operators.
+ //
+ if (options.generate_comparison ())
+ {
+ os << inl
+ << "bool" << endl
+ << "operator== (const " << name << "& x, " <<
+ "const " << name << "& y)"
+ << "{"
+ << "const " << base_type << "& bx (x);"
+ << "return bx == y;"
+ << "}";
+
+ os << inl
+ << "bool" << endl
+ << "operator!= (const " << name << "& x, " <<
+ "const " << name << "& y)"
+ << "{"
+ << "return !(x == y);"
+ << "}";
+ }
}
private: