From 220df45d361ebe658458f630baf117ab0bb31dd5 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Thu, 15 Aug 2024 08:19:21 -0700 Subject: [PATCH] return reference instead of unique_ptr, per @dbaston --- .../geos/geom/prep/BasicPreparedGeometry.h | 4 ++-- src/geom/prep/BasicPreparedGeometry.cpp | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/geos/geom/prep/BasicPreparedGeometry.h b/include/geos/geom/prep/BasicPreparedGeometry.h index 068ade2bc2..f061de451e 100644 --- a/include/geos/geom/prep/BasicPreparedGeometry.h +++ b/include/geos/geom/prep/BasicPreparedGeometry.h @@ -61,12 +61,12 @@ class BasicPreparedGeometry: public PreparedGeometry { std::vector representativePts; mutable std::unique_ptr relate_ng; - std::unique_ptr& getRelateNG() const + RelateNG& getRelateNG() const { if (relate_ng == nullptr) relate_ng = RelateNG::prepare(baseGeom); - return relate_ng; + return *relate_ng; } protected: diff --git a/src/geom/prep/BasicPreparedGeometry.cpp b/src/geom/prep/BasicPreparedGeometry.cpp index c346fcf42f..0718a37b0d 100644 --- a/src/geom/prep/BasicPreparedGeometry.cpp +++ b/src/geom/prep/BasicPreparedGeometry.cpp @@ -93,73 +93,73 @@ BasicPreparedGeometry::isAnyTargetComponentInTest(const geom::Geometry* testGeom bool BasicPreparedGeometry::within(const geom::Geometry* g) const { - return getRelateNG()->within(g); + return getRelateNG().within(g); } bool BasicPreparedGeometry::contains(const geom::Geometry* g) const { - return getRelateNG()->contains(g); + return getRelateNG().contains(g); } bool BasicPreparedGeometry::containsProperly(const geom::Geometry* g) const { - return getRelateNG()->relate(g, "T**FF*FF*"); + return getRelateNG().relate(g, "T**FF*FF*"); } bool BasicPreparedGeometry::coveredBy(const geom::Geometry* g) const { - return getRelateNG()->coveredBy(g); + return getRelateNG().coveredBy(g); } bool BasicPreparedGeometry::covers(const geom::Geometry* g) const { - return getRelateNG()->covers(g); + return getRelateNG().covers(g); } bool BasicPreparedGeometry::crosses(const geom::Geometry* g) const { - return getRelateNG()->crosses(g); + return getRelateNG().crosses(g); } bool BasicPreparedGeometry::disjoint(const geom::Geometry* g) const { - return getRelateNG()->disjoint(g); + return getRelateNG().disjoint(g); } bool BasicPreparedGeometry::intersects(const geom::Geometry* g) const { - return getRelateNG()->intersects(g); + return getRelateNG().intersects(g); } bool BasicPreparedGeometry::overlaps(const geom::Geometry* g) const { - return getRelateNG()->overlaps(g); + return getRelateNG().overlaps(g); } bool BasicPreparedGeometry::touches(const geom::Geometry* g) const { - return getRelateNG()->touches(g); + return getRelateNG().touches(g); } bool BasicPreparedGeometry::relate(const geom::Geometry* g, const std::string& pat) const { - return getRelateNG()->relate(g, pat); + return getRelateNG().relate(g, pat); } std::unique_ptr BasicPreparedGeometry::relate(const geom::Geometry* g) const { - return getRelateNG()->relate(g); + return getRelateNG().relate(g); }