summaryrefslogtreecommitdiff
path: root/src/expr/expr_template.h
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2010-07-10 05:46:41 +0000
committerMorgan Deters <mdeters@gmail.com>2010-07-10 05:46:41 +0000
commitff090033353d68144edf619c19b7911a33e8c5b2 (patch)
treea557d5e5899c663fcc229ab0f4e0a0926fbfe325 /src/expr/expr_template.h
parent9f4784e950f295d45cf6b0bdb1def1b83bb11b1a (diff)
add >, <=, and >= comparisons for Exprs and Nodes
Diffstat (limited to 'src/expr/expr_template.h')
-rw-r--r--src/expr/expr_template.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/expr/expr_template.h b/src/expr/expr_template.h
index 34d4a1a9e..517931477 100644
--- a/src/expr/expr_template.h
+++ b/src/expr/expr_template.h
@@ -160,6 +160,39 @@ public:
bool operator<(const Expr& e) const;
/**
+ * Order comparison operator. The only invariant on the order of expressions
+ * is that the expressions that were created sooner will be smaller in the
+ * ordering than all the expressions created later. Null expression is the
+ * smallest element of the ordering. The behavior of the operator is
+ * undefined if the expressions come from two different expression managers.
+ * @param e the expression to compare to
+ * @return true if this expression is greater than the given one
+ */
+ bool operator>(const Expr& e) const;
+
+ /**
+ * Order comparison operator. The only invariant on the order of expressions
+ * is that the expressions that were created sooner will be smaller in the
+ * ordering than all the expressions created later. Null expression is the
+ * smallest element of the ordering. The behavior of the operator is
+ * undefined if the expressions come from two different expression managers.
+ * @param e the expression to compare to
+ * @return true if this expression is smaller or equal to the given one
+ */
+ bool operator<=(const Expr& e) const { return !(*this > e); }
+
+ /**
+ * Order comparison operator. The only invariant on the order of expressions
+ * is that the expressions that were created sooner will be smaller in the
+ * ordering than all the expressions created later. Null expression is the
+ * smallest element of the ordering. The behavior of the operator is
+ * undefined if the expressions come from two different expression managers.
+ * @param e the expression to compare to
+ * @return true if this expression is greater or equal to the given one
+ */
+ bool operator>=(const Expr& e) const { return !(*this < e); }
+
+ /**
* Returns the kind of the expression (AND, PLUS ...).
* @return the kind of the expression
*/
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback