all repos — fluxbox @ 0a40d1caf3180538d83c7016939d91c7beaf6c2c

custom fork of the fluxbox windowmanager

Add template copy constructor to FbTk::Refcount

and remove a an "almost" copy constructor (almost, because it takes a non-const reference
parameter) which was useless.
Pavel Labath pavelo@centrum.sk
commit

0a40d1caf3180538d83c7016939d91c7beaf6c2c

parent

b9e9eb4e44a30204f719c40edd792f35305af932

1 files changed, 8 insertions(+), 2 deletions(-)

jump to
M src/FbTk/RefCount.hhsrc/FbTk/RefCount.hh

@@ -32,8 +32,9 @@

public: RefCount(); explicit RefCount(Pointer *p); - explicit RefCount(RefCount<Pointer> &copy); RefCount(const RefCount<Pointer> &copy); + template<typename Pointer2> + RefCount(const RefCount<Pointer2> &copy); ~RefCount(); RefCount<Pointer> &operator = (const RefCount<Pointer> &copy); RefCount<Pointer> &operator = (Pointer *p);

@@ -50,6 +51,10 @@ /// decrease reference count

void decRefCount(); Pointer *m_data; ///< data holder unsigned int *m_refcount; ///< holds reference counting + + // we need this for the template copy constructor + template<typename Pointer2> + friend class RefCount; }; // implementation

@@ -60,7 +65,8 @@ incRefCount(); // it really counts how many things are storing m_refcount

} template <typename Pointer> -RefCount<Pointer>::RefCount(RefCount<Pointer> &copy): +template <typename Pointer2> +RefCount<Pointer>::RefCount(const RefCount<Pointer2> &copy): m_data(copy.m_data), m_refcount(copy.m_refcount) { incRefCount();