diff --git a/src/lib/hash-indexed.hpp b/src/lib/hash-indexed.hpp index e57565ea9..4294f69fa 100644 --- a/src/lib/hash-indexed.hpp +++ b/src/lib/hash-indexed.hpp @@ -42,6 +42,7 @@ ** for the generic ID. ** - providing a Mixin, which allows any hierarchy to use this facility without ** much code duplication, including an adapter for tr1::unordered_map + ** - equality comparison ** ** @see HashIndexed_test ** @see Placement usage example @@ -187,6 +188,11 @@ namespace lib { this->id_ = ref.getID(); } + /** equality comparison delegated to the ID implementation */ + friend bool operator== (HashIndexed const& hal, HashIndexed const& har) { return hal.id_==har.id_; } + friend bool operator!= (HashIndexed const& hal, HashIndexed const& har) { return hal.id_!=har.id_; } + + protected: HashIndexed () : id_() {} HashIndexed (IMP const& iref) : id_(iref) {} diff --git a/src/proc/mobject/session/scope.hpp b/src/proc/mobject/session/scope.hpp index a51c0619b..7dbc3ee00 100644 --- a/src/proc/mobject/session/scope.hpp +++ b/src/proc/mobject/session/scope.hpp @@ -32,7 +32,7 @@ #include "lib/error.hpp" //#include "lib/singleton.hpp" -#include +//#include //#include //#include //#include @@ -58,9 +58,6 @@ namespace session { * maintains the current focus location. */ class Scope - : public boost::equality_comparable > - { RefPlacement anchor_; @@ -85,7 +82,7 @@ namespace session { iterator ascend() const; friend bool operator== (Scope const&, Scope const&); - friend bool operator== (Scope const&, PlacementMO const&); + friend bool operator!= (Scope const&, Scope const&); }; @@ -95,10 +92,6 @@ namespace session { /** as scopes are constituted by a "scope top" element (placement) * registered within the PlacementIndex of the current session, * equality is defined in terms of this defining placement. - * Moreover, in this context, \em identity relates to - * being the same thing, when used in the context - * of the session. Thus, it can be reduced - * to comparing the Placement-IDs */ inline bool operator== (Scope const& scope1, Scope const& scope2) @@ -107,12 +100,9 @@ namespace session { } inline bool - operator== (Scope const& scope, PlacementMO const& aScopeTop) + operator!= (Scope const& scope1, Scope const& scope2) { - typedef PlacementMO::ID const& PlacementID; - PlacementID id1 = static_cast (scope.anchor_); - - return id1 == aScopeTop.getID(); + return scope1.anchor_ != scope2.anchor_; }