summaryrefslogtreecommitdiff
path: root/glib/glibmm/refptr.h
diff options
context:
space:
mode:
Diffstat (limited to 'glib/glibmm/refptr.h')
-rw-r--r--glib/glibmm/refptr.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/glib/glibmm/refptr.h b/glib/glibmm/refptr.h
index 79d05ce4..fd57b361 100644
--- a/glib/glibmm/refptr.h
+++ b/glib/glibmm/refptr.h
@@ -68,6 +68,10 @@ public:
*/
inline RefPtr(const RefPtr& src);
+ /** Move constructor
+ */
+ inline RefPtr(RefPtr&& src);
+
/** Copy constructor (from different, but castable type).
*
* Increments the reference count.
@@ -85,6 +89,9 @@ public:
/// Copy from another RefPtr:
inline RefPtr& operator=(const RefPtr& src);
+ /// Move assignment operator:
+ inline RefPtr& operator=(RefPtr&& src);
+
/** Copy from different, but castable type).
*
* Increments the reference count.
@@ -223,6 +230,14 @@ RefPtr<T_CppObject>::RefPtr(const RefPtr& src)
pCppObject_->reference();
}
+template <class T_CppObject> inline
+RefPtr<T_CppObject>::RefPtr(RefPtr&& src)
+:
+ pCppObject_ (src.pCppObject_)
+{
+ src.pCppObject_ = nullptr;
+}
+
// The templated ctor allows copy construction from any object that's
// castable. Thus, it does downcasts:
// base_ref = derived_ref
@@ -280,6 +295,14 @@ RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr& src)
return *this;
}
+template <class T_CppObject> inline
+RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(RefPtr&& src)
+{
+ pCppObject_ = src.pCppObject_;
+ src.pCppObject_ = nullptr;
+ return *this;
+}
+
template <class T_CppObject>
template <class T_CastFrom>
inline