summaryrefslogtreecommitdiff
path: root/src/types.hpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2015-03-30 17:52:31 +0800
committerJohn Hodge <tpg@mutabah.net>2015-03-30 17:52:31 +0800
commitace202ef3d35cb5010e9164900c2c825dd6d3e8e (patch)
tree62fb10e28e795aef13c82d7717384b1affb3c3da /src/types.hpp
parent86e4115964dee385d167fda110ed700012168d06 (diff)
downloadmrust-ace202ef3d35cb5010e9164900c2c825dd6d3e8e.tar.gz
Add ordering to TypeRef and Path (to generalise operator== and operator<
Diffstat (limited to 'src/types.hpp')
-rw-r--r--src/types.hpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/types.hpp b/src/types.hpp
index 5f7c6111..38f2b26b 100644
--- a/src/types.hpp
+++ b/src/types.hpp
@@ -188,8 +188,10 @@ public:
void add_trait(TypeRef trait) { assert(is_wildcard()); m_inner_types.push_back( ::std::move(trait) ); }
const ::std::vector<TypeRef>& traits() const { assert(is_wildcard()); return m_inner_types; }
- bool operator==(const TypeRef& x) const;
- bool operator!=(const TypeRef& x) const { return !(*this == x); }
+ Ordering ord(const TypeRef& x) const;
+ bool operator==(const TypeRef& x) const { return ord(x) == OrdEqual; }
+ bool operator!=(const TypeRef& x) const { return ord(x) != OrdEqual; }
+ bool operator<(const TypeRef& x) const { return ord(x) == OrdLess; };
PrettyPrintType print_pretty() const { return PrettyPrintType(*this); }