diff --git a/src/lib/handle.hpp b/src/lib/handle.hpp index 9da0dd9e5..0d800f3ac 100644 --- a/src/lib/handle.hpp +++ b/src/lib/handle.hpp @@ -35,7 +35,7 @@ ** of the implementation class the handle points at is necessary only in the ** translation unit implementing such an extended handle. ** - ** @see proc::DummyPlayer::Process usage example + ** @see proc::control::Command usage example ** */ @@ -44,15 +44,17 @@ #define LIB_HANDLE_H #include "lib/nobug-init.hpp" -#include "lib/bool-checkable.hpp" #include +#include namespace lib { using std::shared_ptr; + using std::unique_ptr; using std::weak_ptr; + using std::move; @@ -68,7 +70,6 @@ namespace lib { */ template class Handle - : public lib::BoolCheckable> { protected: typedef std::shared_ptr SmPtr; @@ -85,14 +86,23 @@ namespace lib { : smPtr_() { } - Handle (Handle const& r) : smPtr_(r.smPtr_) { } - template explicit Handle (shared_ptr const& r) : smPtr_(r) { } - template explicit Handle (weak_ptr const& wr) : smPtr_(wr) { } - template explicit Handle (std::auto_ptr & ar) : smPtr_(ar) { } + Handle (Handle const& r) = default; + Handle (Handle && rr) = default; + template explicit Handle (shared_ptr const& r) : smPtr_{r} { } + template explicit Handle (shared_ptr && srr) : smPtr_{move(srr)} { } + template explicit Handle (weak_ptr const& wr) : smPtr_{wr} { } + template explicit Handle (unique_ptr && urr) : smPtr_{move(urr)} { } + + Handle& operator=(Handle const& r) = default; + Handle& operator=(Handle && rr) = default; + template Handle& operator=(shared_ptr const& sr) { smPtr_ = sr; return *this; } + template Handle& operator=(shared_ptr && srr) { smPtr_ = move(srr); return *this; } + template Handle& operator=(unique_ptr && urr) { smPtr_ = move(urr); return *this; } + + + explicit operator bool() const { return bool(smPtr_); } + bool isValid() const { return bool(smPtr_); } - Handle& operator=(Handle const& r) { smPtr_ = r.smPtr_; return *this; } - template Handle& operator=(shared_ptr const& sr) { smPtr_ = sr; return *this; } - template Handle& operator=(std::auto_ptr & ar) { smPtr_ = ar; return *this; } /** Activation of the handle by the managing service. @@ -126,11 +136,6 @@ namespace lib { void close () { smPtr_.reset(); } - /** implicit conversion to bool (BoolCheckable) */ - bool isValid() const { return bool(smPtr_);} - - - protected: IMP&