diff --git a/src/wrapper.hh b/src/wrapper.hh index 6c80fe0..4344329 100644 --- a/src/wrapper.hh +++ b/src/wrapper.hh @@ -29,9 +29,16 @@ public: ~Wrapper(); Wrapper copy() const; - - friend - bool operator==(const Wrapper& a, const Wrapper& b); + + bool operator==(const Wrapper& b) const + { + return value==b.value; + } + + bool operator!=(const Wrapper& b) const + { + return value!=b.value; + } private: // must be defined for each wrapped type: @@ -78,11 +85,18 @@ public: _free(value); } + bool operator==(const Wrapper& b) const + { + return value==b.value; + } + + bool operator!=(const Wrapper& b) const + { + return value!=b.value; + } + const T* get() const { return value; } T* move_out() { T* r = value; value=nullptr; return r;} - - friend - bool operator==(const Wrapper& a, const Wrapper& b); protected: @@ -97,12 +111,6 @@ protected: T* value; }; -template -inline -bool operator!=(const Wrapper& a, const Wrapper& b) -{ - return !(a==b); -} // Wraps single-linked lists and provides an interface compatible