[glibmm] gmmproc: _CLASS_OPAQUE_COPYABLE(): Add move operations.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] gmmproc: _CLASS_OPAQUE_COPYABLE(): Add move operations.
- Date: Sat, 22 Aug 2015 19:40:07 +0000 (UTC)
commit 233d4ff7915f2d1ed52651220ec4ecd334f1a8c9
Author: Murray Cumming <murrayc murrayc com>
Date: Sat Aug 22 12:06:39 2015 +0200
gmmproc: _CLASS_OPAQUE_COPYABLE(): Add move operations.
The same as in _CLASS_BOXEDTYPE().
tools/m4/class_opaque_copyable.m4 | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/tools/m4/class_opaque_copyable.m4 b/tools/m4/class_opaque_copyable.m4
index f3fe4bd..5873925 100644
--- a/tools/m4/class_opaque_copyable.m4
+++ b/tools/m4/class_opaque_copyable.m4
@@ -133,12 +133,33 @@ __CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& src)
}
')dnl
+__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& other) noexcept
+:
+ gobject_(other.gobject_)
+{
+ other.gobject_ = nullptr;
+}
+
+__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__`'&& other) noexcept
+{
+ __CPPNAME__ temp (other);
+ swap(temp);
+ return *this;
+}
+
__CPPNAME__::~__CPPNAME__`'()
{
if(gobject_)
__OPAQUE_FUNC_FREE`'(gobject_);
}
+void __CPPNAME__::swap(__CPPNAME__& other) noexcept
+{
+ __CNAME__ *const temp = gobject_;
+ gobject_ = other.gobject_;
+ other.gobject_ = temp;
+}
+
__CNAME__* __CPPNAME__::gobj_copy() const
{
return __OPAQUE_FUNC_COPY`'(gobject_);
@@ -180,9 +201,14 @@ ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',`dnl
__CPPNAME__`'(const __CPPNAME__& src);
__CPPNAME__& operator=(const __CPPNAME__& src);
+ __CPPNAME__`'(__CPPNAME__&& other) noexcept;
+ __CPPNAME__& operator=(__CPPNAME__&& other) noexcept;
+
_IMPORT(SECTION_DTOR_DOCUMENTATION)
~__CPPNAME__`'();
+ void swap(__CPPNAME__& other) noexcept;
+
__CNAME__* gobj() { return gobject_; }
const __CNAME__* gobj() const { return gobject_; }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]