From ff0fe2edd9260f19a01c29795ac17bd13c7ee8df Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 21 Nov 2008 10:57:27 +0000 Subject: [PATCH] 0019957: EDF 785 SMESH: Convert Quadratic and Group on GEOM return bool from Remove() --- src/SMDS/SMDS_MeshGroup.cxx | 11 ++++++++--- src/SMDS/SMDS_MeshGroup.hxx | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/SMDS/SMDS_MeshGroup.cxx b/src/SMDS/SMDS_MeshGroup.cxx index e003c9219..d00abe013 100644 --- a/src/SMDS/SMDS_MeshGroup.cxx +++ b/src/SMDS/SMDS_MeshGroup.cxx @@ -137,10 +137,15 @@ void SMDS_MeshGroup::Add(const SMDS_MeshElement * theElem) //purpose : //======================================================================= -void SMDS_MeshGroup::Remove(const SMDS_MeshElement * theElem) +bool SMDS_MeshGroup::Remove(const SMDS_MeshElement * theElem) { - myElements.erase(theElem); - if (myElements.empty()) myType = SMDSAbs_All; + TIterator found = myElements.find(theElem); + if ( found != myElements.end() ) { + myElements.erase(found); + if (myElements.empty()) myType = SMDSAbs_All; + return true; + } + return false; } //======================================================================= diff --git a/src/SMDS/SMDS_MeshGroup.hxx b/src/SMDS/SMDS_MeshGroup.hxx index f23b601b7..94a6deb89 100644 --- a/src/SMDS/SMDS_MeshGroup.hxx +++ b/src/SMDS/SMDS_MeshGroup.hxx @@ -46,7 +46,7 @@ class SMDS_EXPORT SMDS_MeshGroup:public SMDS_MeshObject void SetType (const SMDSAbs_ElementType theType); void Clear(); void Add(const SMDS_MeshElement * theElem); - void Remove(const SMDS_MeshElement * theElem); + bool Remove(const SMDS_MeshElement * theElem); bool IsEmpty() const { return myElements.empty(); } int Extent() const { return myElements.size(); } -- 2.39.2