diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-04-01 01:10:37 +0200 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2016-04-25 22:19:28 +0200 |
commit | 8449b32aee3a784622a4a2c1ace47b330da058c0 (patch) | |
tree | edd307724c8b11961737658e887b33cdeb4d9bda /src | |
parent | c191519ce36097d4f1855f90524861d909818512 (diff) |
Fix broken smaller than operator leading to crash in std::sort
Diffstat (limited to 'src')
-rw-r--r-- | src/core/model/Syntax.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/model/Syntax.cpp b/src/core/model/Syntax.cpp index 0e92ef5..b31b41c 100644 --- a/src/core/model/Syntax.cpp +++ b/src/core/model/Syntax.cpp @@ -41,11 +41,13 @@ bool operator==(const SyntaxDescriptor &o1, const SyntaxDescriptor &o2) bool operator<(const SyntaxDescriptor &o1, const SyntaxDescriptor &o2) { - return (o1.depth < o2.depth) || - (o1.isFieldDescriptor() && !o2.isFieldDescriptor()) || - (o1.open < o2.open) || (o1.close < o2.close) || - (o1.shortForm < o2.shortForm) || - (o1.descriptor.get() < o2.descriptor.get()); +#define LTOP(X1, X2, OTHER) ((X1 != X2) ? ((X1 < X2) ? true : false) : OTHER) + return LTOP( + o1.depth, o2.depth, + LTOP(o1.open, o2.open, + LTOP(o1.close, o2.close, LTOP(o1.shortForm, o2.shortForm, + LTOP(o1.descriptor.get(), + o2.descriptor.get(), false))))); } bool SyntaxDescriptor::isAnnotation() const |