[geos-commits] r3540 - in trunk: include/geos/geom include/geos/operation/overlay/snap src/operation/overlay/snap

svn_geos at osgeo.org svn_geos at osgeo.org
Fri Dec 9 05:54:27 EST 2011


Author: strk
Date: 2011-12-09 02:54:27 -0800 (Fri, 09 Dec 2011)
New Revision: 3540

Modified:
   trunk/include/geos/geom/Geometry.h
   trunk/include/geos/operation/overlay/snap/GeometrySnapper.h
   trunk/include/geos/operation/overlay/snap/SnapOverlayOp.h
   trunk/src/operation/overlay/snap/GeometrySnapper.cpp
   trunk/src/operation/overlay/snap/SnapOverlayOp.cpp
Log:
Fix C++11 build by avoiding std::pair<auto_ptr> (#491)

Modified: trunk/include/geos/geom/Geometry.h
===================================================================
--- trunk/include/geos/geom/Geometry.h	2011-12-09 10:46:33 UTC (rev 3539)
+++ trunk/include/geos/geom/Geometry.h	2011-12-09 10:54:27 UTC (rev 3540)
@@ -875,6 +875,14 @@
  */
 std::string jtsport();
 
+// We use this instead of std::pair<auto_ptr<Geometry>> because C++11
+// forbids that construct:
+// http://lwg.github.com/issues/lwg-closed.html#2068
+struct GeomPtrPair {
+	typedef std::auto_ptr<Geometry> GeomPtr;
+	GeomPtr first;
+	GeomPtr second;
+};
 
 } // namespace geos::geom
 } // namespace geos

Modified: trunk/include/geos/operation/overlay/snap/GeometrySnapper.h
===================================================================
--- trunk/include/geos/operation/overlay/snap/GeometrySnapper.h	2011-12-09 10:46:33 UTC (rev 3539)
+++ trunk/include/geos/operation/overlay/snap/GeometrySnapper.h	2011-12-09 10:54:27 UTC (rev 3540)
@@ -31,6 +31,7 @@
 		//class PrecisionModel;
 		class Geometry;
 		class CoordinateSequence;
+		struct GeomPtrPair;
 	}
 }
 
@@ -59,7 +60,6 @@
 public:
 
 	typedef std::auto_ptr<geom::Geometry> GeomPtr;
-	typedef std::pair<GeomPtr, GeomPtr> GeomPtrPair;
 
 	/**
 	 * Snaps two geometries together with a given tolerance.
@@ -72,7 +72,7 @@
 	 */
 	static void snap(const geom::Geometry& g0,
 	                        const geom::Geometry& g1,
-	                        double snapTolerance, GeomPtrPair& ret);
+	                        double snapTolerance, geom::GeomPtrPair& ret);
 
 	static GeomPtr snapToSelf(const geom::Geometry& g0,
 	                        double snapTolerance, bool cleanResult);

Modified: trunk/include/geos/operation/overlay/snap/SnapOverlayOp.h
===================================================================
--- trunk/include/geos/operation/overlay/snap/SnapOverlayOp.h	2011-12-09 10:46:33 UTC (rev 3539)
+++ trunk/include/geos/operation/overlay/snap/SnapOverlayOp.h	2011-12-09 10:54:27 UTC (rev 3540)
@@ -33,6 +33,7 @@
 namespace geos {
 	namespace geom {
 		class Geometry;
+		struct GeomPtrPair;
 	}
 }
 
@@ -106,12 +107,11 @@
 
 	void computeSnapTolerance();
 
-	typedef std::pair<GeomPtr, GeomPtr> GeomPtrPair;
+	void snap(geom::GeomPtrPair& ret);
 
-	void snap(GeomPtrPair& ret);
-
 	void removeCommonBits(const geom::Geometry& geom0,
-	                      const geom::Geometry& geom1, GeomPtrPair& ret);
+	                      const geom::Geometry& geom1,
+	                      geom::GeomPtrPair& ret);
 
 	// re-adds common bits to the given geom
 	void prepareResult(geom::Geometry& geom);

Modified: trunk/src/operation/overlay/snap/GeometrySnapper.cpp
===================================================================
--- trunk/src/operation/overlay/snap/GeometrySnapper.cpp	2011-12-09 10:46:33 UTC (rev 3539)
+++ trunk/src/operation/overlay/snap/GeometrySnapper.cpp	2011-12-09 10:54:27 UTC (rev 3540)
@@ -192,7 +192,7 @@
 GeometrySnapper::snap(const geom::Geometry& g0,
                       const geom::Geometry& g1,
                       double snapTolerance,
-                      GeometrySnapper::GeomPtrPair& snapGeom)
+                      geom::GeomPtrPair& snapGeom)
 {
 	GeometrySnapper snapper0(g0);
 	snapGeom.first = snapper0.snapTo(g1, snapTolerance);

Modified: trunk/src/operation/overlay/snap/SnapOverlayOp.cpp
===================================================================
--- trunk/src/operation/overlay/snap/SnapOverlayOp.cpp	2011-12-09 10:46:33 UTC (rev 3539)
+++ trunk/src/operation/overlay/snap/SnapOverlayOp.cpp	2011-12-09 10:54:27 UTC (rev 3540)
@@ -51,7 +51,7 @@
 auto_ptr<Geometry>
 SnapOverlayOp::getResultGeometry(OverlayOp::OpCode opCode)
 {
-	GeomPtrPair prepGeom;
+	geom::GeomPtrPair prepGeom;
 	snap(prepGeom);
 	GeomPtr result ( OverlayOp::overlayOp(prepGeom.first.get(),
 	                                      prepGeom.second.get(), opCode) );
@@ -61,9 +61,9 @@
 
 /* private */
 void
-SnapOverlayOp::snap(SnapOverlayOp::GeomPtrPair& snapGeom)
+SnapOverlayOp::snap(geom::GeomPtrPair& snapGeom)
 {
-	GeomPtrPair remGeom;
+	geom::GeomPtrPair remGeom;
 	removeCommonBits(geom0, geom1, remGeom);
 
 	GeometrySnapper::snap(*remGeom.first, *remGeom.second,
@@ -85,7 +85,7 @@
 void
 SnapOverlayOp::removeCommonBits(const geom::Geometry& geom0,
                                 const geom::Geometry& geom1,
-				SnapOverlayOp::GeomPtrPair& remGeom)
+				geom::GeomPtrPair& remGeom)
 {
 	cbr.reset(new precision::CommonBitsRemover());
 	cbr->add(&geom0);



More information about the geos-commits mailing list