[geos-commits] [SCM] GEOS branch master updated. 83b5ecf270493475ef95cd9ab005c3ae09bdda6e

git at osgeo.org git at osgeo.org
Fri Dec 28 17:53:03 PST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, master has been updated
       via  83b5ecf270493475ef95cd9ab005c3ae09bdda6e (commit)
      from  16a39b0b1a79cfd4c7e2da5c14999a766432acae (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 83b5ecf270493475ef95cd9ab005c3ae09bdda6e
Author: Daniel Baston <dbaston at gmail.com>
Date:   Fri Dec 28 20:10:31 2018 -0500

    Replace fixed-size std::vector with std::array

diff --git a/include/geos/operation/distance/DistanceOp.h b/include/geos/operation/distance/DistanceOp.h
index de6110d..c9f64b4 100644
--- a/include/geos/operation/distance/DistanceOp.h
+++ b/include/geos/operation/distance/DistanceOp.h
@@ -24,6 +24,7 @@
 
 #include <geos/algorithm/PointLocator.h> // for composition
 
+#include <array>
 #include <vector>
 
 #ifdef _MSC_VER
@@ -209,8 +210,8 @@ private:
 	 */
 	std::vector<GeometryLocation*>* nearestLocations();
 
-	// input (TODO: use two references instead..)
-	std::vector<geom::Geometry const*> geom;
+	// input
+	std::array<geom::Geometry const*, 2> geom;
 	double terminateDistance;
 
 	// working
diff --git a/src/operation/distance/DistanceOp.cpp b/src/operation/distance/DistanceOp.cpp
index a1db735..a5fdcdb 100644
--- a/src/operation/distance/DistanceOp.cpp
+++ b/src/operation/distance/DistanceOp.cpp
@@ -87,35 +87,26 @@ DistanceOp::nearestPoints(const Geometry *g0, const Geometry *g1)
 }
 
 DistanceOp::DistanceOp(const Geometry *g0, const Geometry *g1):
-	geom(2),
+	geom{g0, g1},
 	terminateDistance(0.0),
 	minDistanceLocation(nullptr),
 	minDistance(DoubleMax)
-{
-	geom[0] = g0;
-	geom[1] = g1;
-}
+{}
 
 DistanceOp::DistanceOp(const Geometry& g0, const Geometry& g1):
-	geom(2),
+	geom{&g0, &g1},
 	terminateDistance(0.0),
 	minDistanceLocation(nullptr),
 	minDistance(DoubleMax)
-{
-	geom[0] = &g0;
-	geom[1] = &g1;
-}
+{}
 
 DistanceOp::DistanceOp(const Geometry& g0, const Geometry& g1, double tdist)
 	:
-	geom(2),
+	geom{&g0, &g1},
 	terminateDistance(tdist),
 	minDistanceLocation(nullptr),
 	minDistance(DoubleMax)
-{
-	geom[0] = &g0;
-	geom[1] = &g1;
-}
+{}
 
 DistanceOp::~DistanceOp()
 {

-----------------------------------------------------------------------

Summary of changes:
 include/geos/operation/distance/DistanceOp.h |  5 +++--
 src/operation/distance/DistanceOp.cpp        | 21 ++++++---------------
 2 files changed, 9 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list