From: Anthony Geay Date: Fri, 19 Aug 2022 12:53:09 +0000 (+0200) Subject: Remove useless usage of dynamic allocation into BoundingBox class X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2b23b0734a1cc323ffaa38f90afbbf18c2037b73;p=tools%2Fmedcoupling.git Remove useless usage of dynamic allocation into BoundingBox class --- diff --git a/src/INTERP_KERNEL/BoundingBox.cxx b/src/INTERP_KERNEL/BoundingBox.cxx index ab192e4f6..db5fd0918 100644 --- a/src/INTERP_KERNEL/BoundingBox.cxx +++ b/src/INTERP_KERNEL/BoundingBox.cxx @@ -36,10 +36,7 @@ namespace INTERP_KERNEL * */ BoundingBox::BoundingBox(const double** pts, const unsigned numPts) - :_coords(new double[6]) { - assert(numPts > 0); - // initialize with first two points const double *pt0(pts[0]); @@ -63,11 +60,8 @@ namespace INTERP_KERNEL * @param box1 the first box * @param box2 the second box */ - BoundingBox::BoundingBox(const BoundingBox& box1, const BoundingBox& box2) - : _coords(new double[6]) + BoundingBox::BoundingBox(const BoundingBox& box1, const BoundingBox& box2) { - assert(_coords != 0); - for(BoxCoord c = XMIN ; c <= ZMIN ; c = BoxCoord(c + 1)) { _coords[c] = std::min(box1._coords[c], box2._coords[c]); @@ -77,15 +71,6 @@ namespace INTERP_KERNEL assert(isValid()); } - /** - * Destructor - * - */ - BoundingBox::~BoundingBox() - { - delete [] _coords; - } - /** * Determines if the intersection with a given box is empty * diff --git a/src/INTERP_KERNEL/BoundingBox.hxx b/src/INTERP_KERNEL/BoundingBox.hxx index d453e8a62..52641ccf3 100644 --- a/src/INTERP_KERNEL/BoundingBox.hxx +++ b/src/INTERP_KERNEL/BoundingBox.hxx @@ -41,7 +41,7 @@ namespace INTERP_KERNEL BoundingBox(const BoundingBox& box1, const BoundingBox& box2); - ~BoundingBox(); + ~BoundingBox() { } bool isDisjointWith(const BoundingBox& box) const; @@ -67,7 +67,7 @@ namespace INTERP_KERNEL /// Vector containing the coordinates of the box /// interlaced in the order XMIN, YMIN, ZMIN, XMAX, YMAX, ZMAX - double* _coords; + double _coords[6]; };