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.
Pavel Labath pavelo@centrum.sk
1 files changed,
30 insertions(+),
0 deletions(-)
jump to
M
src/FbTk/RefCount.hh
→
src/FbTk/RefCount.hh
@@ -152,6 +152,36 @@ inline RefCount<Pointer> makeRef(const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) {
return RefCount<Pointer>(new Pointer(arg1, arg2, arg3)); } +template <typename Pointer, typename Pointer2> +inline bool operator == (const RefCount<Pointer> &a, const RefCount<Pointer2> &b) { + return a.get() == b.get(); +} + +template <typename Pointer, typename Pointer2> +inline bool operator != (const RefCount<Pointer> &a, const RefCount<Pointer2> &b) { + return a.get() != b.get(); +} + +template <typename Pointer, typename Pointer2> +inline bool operator < (const RefCount<Pointer> &a, const RefCount<Pointer2> &b) { + return a.get() < b.get(); +} + +template <typename Pointer, typename Pointer2> +inline bool operator > (const RefCount<Pointer> &a, const RefCount<Pointer2> &b) { + return a.get() > b.get(); +} + +template <typename Pointer, typename Pointer2> +inline bool operator <= (const RefCount<Pointer> &a, const RefCount<Pointer2> &b) { + return a.get() <= b.get(); +} + +template <typename Pointer, typename Pointer2> +inline bool operator >= (const RefCount<Pointer> &a, const RefCount<Pointer2> &b) { + return a.get() >= b.get(); +} + } // end namespace FbTk #endif // FBTK_REFCOUNT_HH