diff options
author | John Hodge <tpg@mutabah.net> | 2015-03-30 17:52:31 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-03-30 17:52:31 +0800 |
commit | ace202ef3d35cb5010e9164900c2c825dd6d3e8e (patch) | |
tree | 62fb10e28e795aef13c82d7717384b1affb3c3da /src/types.hpp | |
parent | 86e4115964dee385d167fda110ed700012168d06 (diff) | |
download | mrust-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.hpp | 6 |
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); }
|