[glibmm] gmmproc: swap() implementations: Use std::swap().
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] gmmproc: swap() implementations: Use std::swap().
- Date: Thu, 28 Jul 2016 09:00:35 +0000 (UTC)
commit ddec69b2fafc7c448f330dfd23e77d94c33d2d82
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Jul 28 10:58:42 2016 +0200
gmmproc: swap() implementations: Use std::swap().
Because this simplifies the code.
tools/m4/class_boxedtype.m4 | 4 +---
tools/m4/class_opaque_copyable.m4 | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/tools/m4/class_boxedtype.m4 b/tools/m4/class_boxedtype.m4
index ae0a92e..a5046f5 100644
--- a/tools/m4/class_boxedtype.m4
+++ b/tools/m4/class_boxedtype.m4
@@ -175,9 +175,7 @@ dnl This could be a free or an unref, we do not need to know.
void __CPPNAME__::swap(__CPPNAME__& other) noexcept
{
- __CNAME__ *const temp = gobject_;
- gobject_ = other.gobject_;
- other.gobject_ = temp;
+ std::swap(gobject_, other.gobject_);
}
__CNAME__* __CPPNAME__::gobj_copy() const
diff --git a/tools/m4/class_opaque_copyable.m4 b/tools/m4/class_opaque_copyable.m4
index 26148e9..7e04921 100644
--- a/tools/m4/class_opaque_copyable.m4
+++ b/tools/m4/class_opaque_copyable.m4
@@ -166,9 +166,7 @@ __CPPNAME__::~__CPPNAME__`'() noexcept
void __CPPNAME__::swap(__CPPNAME__& other) noexcept
{
- __CNAME__ *const temp = gobject_;
- gobject_ = other.gobject_;
- other.gobject_ = temp;
+ std::swap(gobject_, other.gobject_);
}
__CNAME__* __CPPNAME__::gobj_copy() const
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]