Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=03441a04b280b57fe20628122fc6f22a45f594e2
commit 03441a04b280b57fe20628122fc6f22a45f594e2 Author: Michel Hermier <herm...@frugalware.org> Date: Mon Nov 3 08:25:54 2014 +0100 libpacman: Make a more proper interaction with refcounted_ptr in refcounted_shared_ptr. diff --git a/lib/libpacman/kernel/frefcounted.h b/lib/libpacman/kernel/frefcounted.h index 1b05f1e..2eb4386 100644 --- a/lib/libpacman/kernel/frefcounted.h +++ b/lib/libpacman/kernel/frefcounted.h @@ -67,6 +67,9 @@ namespace flib template <class T> class refcounted_ptr { + public: + typedef T element_type; + protected: refcounted_ptr() : m_refcounted_ptr(nullptr) @@ -166,7 +169,6 @@ namespace flib { : public refcounted_ptr<T> { public: - typedef T element_type; typedef refcounted_ptr<T> super_type; constexpr refcounted_shared_ptr() @@ -184,14 +186,23 @@ namespace flib { } template <class Y> - refcounted_shared_ptr(const refcounted_shared_ptr<Y> &o) + refcounted_shared_ptr(const refcounted_ptr<Y> &o) : refcounted_shared_ptr(o.get()) { } - refcounted_shared_ptr(const refcounted_shared_ptr &o) + refcounted_shared_ptr(const refcounted_ptr<T> &o) : refcounted_shared_ptr(o.get()) { } + template <class Y> + refcounted_shared_ptr(const refcounted_shared_ptr<Y> &o) + : refcounted_shared_ptr(static_cast<const refcounted_ptr<Y> &>(o)) + { } + + refcounted_shared_ptr(const refcounted_shared_ptr &o) + : refcounted_shared_ptr(static_cast<const refcounted_ptr<T> &>(o)) + { } + refcounted_shared_ptr(refcounted_shared_ptr &&o) : refcounted_shared_ptr() { @@ -204,18 +215,29 @@ namespace flib { } template <class Y> - refcounted_shared_ptr &operator = (const refcounted_shared_ptr<Y> &o) + refcounted_shared_ptr &operator = (const refcounted_ptr<Y> &o) { reset(o.get()); return *this; } - refcounted_shared_ptr &operator = (const refcounted_shared_ptr &o) + refcounted_shared_ptr &operator = (const refcounted_ptr<T> &o) { reset(o.get()); return *this; } + template <class Y> + refcounted_shared_ptr &operator = (const refcounted_shared_ptr<Y> &o) + { + return operator = (static_cast<const refcounted_ptr<Y> &>(o)); + } + + refcounted_shared_ptr &operator = (const refcounted_shared_ptr<T> &o) + { + return operator = (static_cast<const refcounted_ptr<T> &>(o)); + } + refcounted_shared_ptr &operator = (refcounted_shared_ptr &&o) { swap(o); _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git