From 05b5974e62fc2ae23262a4930206be8342b148fb Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 25 Jul 2011 15:39:41 +0200 Subject: Add comparison operators to FbTk::RefCount without them, gcc would compare them by converting them to bool first, which is not exactly what one would expect. Frankly, I'm surprised it even worked without this. --- src/FbTk/RefCount.hh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/FbTk/RefCount.hh b/src/FbTk/RefCount.hh index cc8c917..5325b78 100644 --- a/src/FbTk/RefCount.hh +++ b/src/FbTk/RefCount.hh @@ -152,6 +152,36 @@ inline RefCount makeRef(const Arg1 &arg1, const Arg2 &arg2, const Arg3 return RefCount(new Pointer(arg1, arg2, arg3)); } +template +inline bool operator == (const RefCount &a, const RefCount &b) { + return a.get() == b.get(); +} + +template +inline bool operator != (const RefCount &a, const RefCount &b) { + return a.get() != b.get(); +} + +template +inline bool operator < (const RefCount &a, const RefCount &b) { + return a.get() < b.get(); +} + +template +inline bool operator > (const RefCount &a, const RefCount &b) { + return a.get() > b.get(); +} + +template +inline bool operator <= (const RefCount &a, const RefCount &b) { + return a.get() <= b.get(); +} + +template +inline bool operator >= (const RefCount &a, const RefCount &b) { + return a.get() >= b.get(); +} + } // end namespace FbTk #endif // FBTK_REFCOUNT_HH -- cgit v0.11.2