From 0a40d1caf3180538d83c7016939d91c7beaf6c2c Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 14 Jun 2011 16:47:32 +0200 Subject: 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. --- src/FbTk/RefCount.hh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/FbTk/RefCount.hh b/src/FbTk/RefCount.hh index 597f847..fe267e3 100644 --- a/src/FbTk/RefCount.hh +++ b/src/FbTk/RefCount.hh @@ -32,8 +32,9 @@ class RefCount { public: RefCount(); explicit RefCount(Pointer *p); - explicit RefCount(RefCount ©); RefCount(const RefCount ©); + template + RefCount(const RefCount ©); ~RefCount(); RefCount &operator = (const RefCount ©); RefCount &operator = (Pointer *p); @@ -50,6 +51,10 @@ private: void decRefCount(); Pointer *m_data; ///< data holder unsigned int *m_refcount; ///< holds reference counting + + // we need this for the template copy constructor + template + friend class RefCount; }; // implementation @@ -60,7 +65,8 @@ RefCount::RefCount():m_data(0), m_refcount(new unsigned int(0)) { } template -RefCount::RefCount(RefCount ©): +template +RefCount::RefCount(const RefCount ©): m_data(copy.m_data), m_refcount(copy.m_refcount) { incRefCount(); -- cgit v0.11.2