From e48a468d0916b28e826a67fa9f878502ab120fe2 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Fri, 3 Aug 2018 17:32:36 +0200 Subject: [PATCH] Return a copy for Geomerty::center() This is mandated by the DUNE interface. It also makes a lot of sense because now people do not need to think whether const auto& center = entity.geometry().center(); might cause a dangling reference. It just wont as it is always a copy and never a reference to a member. --- opm/grid/cpgrid/Geometry.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opm/grid/cpgrid/Geometry.hpp b/opm/grid/cpgrid/Geometry.hpp index 5280d7b07..79ab748b3 100644 --- a/opm/grid/cpgrid/Geometry.hpp +++ b/opm/grid/cpgrid/Geometry.hpp @@ -253,7 +253,7 @@ namespace Dune } /// Returns the centroid of the geometry. - const GlobalCoordinate& center() const + GlobalCoordinate center() const { return pos_; }