[gtkmm] C++11: TimeCoord: Add move operations.



commit 04c3a6bad05ac8cc8029d298f4f0fe061f747b79
Author: Murray Cumming <murrayc murrayc com>
Date:   Sun Aug 23 20:10:35 2015 +0200

    C++11: TimeCoord: Add move operations.

 gdk/src/timecoord.ccg |   14 ++++++++++++++
 gdk/src/timecoord.hg  |    6 ++++++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/gdk/src/timecoord.ccg b/gdk/src/timecoord.ccg
index b35826a..47586ef 100644
--- a/gdk/src/timecoord.ccg
+++ b/gdk/src/timecoord.ccg
@@ -24,6 +24,20 @@ TimeCoord::TimeCoord(GdkTimeCoord* castitem)
 : gobject_(castitem)
 {}
 
+TimeCoord::TimeCoord(TimeCoord&& other) noexcept
+: gobject_(std::move(other.gobject_))
+{
+}
+
+TimeCoord& TimeCoord::operator=(TimeCoord&& other) noexcept
+{
+  gobject_ = std::move(other.gobject_);
+
+  other.gobject_ = nullptr;
+
+  return *this;
+}
+
 double TimeCoord::get_value_at_axis(guint index) const
 {
   if (gobject_)
diff --git a/gdk/src/timecoord.hg b/gdk/src/timecoord.hg
index f004ca8..6944e48 100644
--- a/gdk/src/timecoord.hg
+++ b/gdk/src/timecoord.hg
@@ -31,7 +31,13 @@ class TimeCoord
 public:
   explicit TimeCoord(GdkTimeCoord* castitem);
 
+  //TODO: = delete the copy operations?
+
+  TimeCoord(TimeCoord&& other) noexcept;
+  TimeCoord& operator=(TimeCoord&& other) noexcept;
+
   _MEMBER_GET(time, time, guint32, guint32);
+
   /** Gets value at @a index axis.
    * @note
    * Gdk::Device::get_n_axes() will tell you how many axes are stored here.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]