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.
This commit is contained in:
parent
536a16e6e2
commit
05b5974e62
1 changed files with 30 additions and 0 deletions
|
@ -152,6 +152,36 @@ inline RefCount<Pointer> makeRef(const Arg1 &arg1, const Arg2 &arg2, const 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
|
||||
|
|
Loading…
Reference in a new issue