[gtkmm] Point: Add copy and move operations.



commit 74d2e86fd3e2183c4c2695a43fff99e91d97a48e
Author: Murray Cumming <murrayc murrayc com>
Date:   Sun Aug 23 20:10:46 2015 +0200

    Point: Add copy and move operations.
    
    We must have been using the default-generated copy operations
    until now. And we could use the default-generated move operations too.
    But being explicit makes it easier to maintain ABI.

 gdk/src/types.ccg |   24 ++++++++++++++++++++++++
 gdk/src/types.hg  |    6 ++++++
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gdk/src/types.ccg b/gdk/src/types.ccg
index efa4da1..6ca71d2 100644
--- a/gdk/src/types.ccg
+++ b/gdk/src/types.ccg
@@ -30,6 +30,30 @@ Point::Point(int x, int y)
   gobject_.y = y;
 }
 
+Point::Point(const Point& other) noexcept
+: gobject_(other.gobject_)
+{
+}
+
+Point& Point::operator=(const Point&& other) noexcept
+{
+  gobject_ = other.gobject_;
+
+  return *this;
+}
+
+Point::Point(Point&& other) noexcept
+: gobject_(std::move(other.gobject_))
+{
+}
+
+Point& Point::operator=(Point&& other) noexcept
+{
+  gobject_ = std::move(other.gobject_);
+
+  return *this;
+}
+
 bool Point::equal(const Gdk::Point& rhs) const
 {
   return (gobject_.x == rhs.gobject_.x) && (gobject_.y == rhs.gobject_.y);
diff --git a/gdk/src/types.hg b/gdk/src/types.hg
index fa813d2..7cb7d6a 100644
--- a/gdk/src/types.hg
+++ b/gdk/src/types.hg
@@ -73,6 +73,12 @@ public:
   Point();
   Point(int x, int y);
 
+  Point(const Point& other) noexcept;
+  Point& operator=(const Point&& other) noexcept;
+
+  Point(Point&& other) noexcept;
+  Point& operator=(Point&& other) noexcept;
+
   void set_x(int x) { gobject_.x = x; }
   void set_y(int y) { gobject_.y = y; }
 


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