[cluttermm] Point: Replace the regularly-generated default constructor.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cluttermm] Point: Replace the regularly-generated default constructor.
- Date: Thu, 13 Mar 2014 10:11:19 +0000 (UTC)
commit 1cc41f641d5356542a2c6672809db7aef4b5de2b
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Mar 13 11:09:53 2014 +0100
Point: Replace the regularly-generated default constructor.
Because it creates a null underlying GObject, which is not what
people would expect, and which is hopefully not necessary.
clutter/src/types.hg | 6 +++++-
tests/test-point-class.cc | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/clutter/src/types.hg b/clutter/src/types.hg
index e6f7e97..2ce1e15 100644
--- a/clutter/src/types.hg
+++ b/clutter/src/types.hg
@@ -92,9 +92,13 @@ class Point
public:
+ //We do not want the normal generated constructor
+ //because that creates an unusable object.
+ _CUSTOM_DEFAULT_CTOR
+
/** Constructor.
*/
- Point(float x, float y);
+ explicit Point(float x = 0, float y = 0);
// This constructor is just here to prevent calls to Point(int, int) being ambiguous
// between Point(float, float) and Point(ClutterPoint*, bool).
diff --git a/tests/test-point-class.cc b/tests/test-point-class.cc
index 37dc7ab..fbe341e 100644
--- a/tests/test-point-class.cc
+++ b/tests/test-point-class.cc
@@ -8,7 +8,7 @@ int main(int argc, char** argv)
std::cout << "Creating Clutter::Point with (int) values: 8, 15" << std::endl;
- Clutter::Point point0(0, 0);
+ Clutter::Point point0;
Clutter::Point point1(8, 15);
std::cout << "Initialisation: point0 = " << point0.get_x() <<
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]