all repos — fluxbox @ 05b5974e62fc2ae23262a4930206be8342b148fb

custom fork of the fluxbox windowmanager

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
commit

05b5974e62fc2ae23262a4930206be8342b148fb

parent

536a16e6e2d9080aec9df9d488d41296888e5cd9

1 files changed, 30 insertions(+), 0 deletions(-)

jump to
M src/FbTk/RefCount.hhsrc/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