Skip to content

Commit

Permalink
Fixed removing objects from the _instances list in the CPP code
Browse files Browse the repository at this point in the history
  Now using the erase–remove idiom
  • Loading branch information
Daniel Segesdi committed Jun 25, 2015
1 parent 3c3b767 commit 0948611
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class ClassTemplates {
// Destructor
«IF destructors.size == 0»
«cppFQN»::~«cppClassName»() {
_instances.erase(std::find(_instances.begin(), _instances.end(), this));
_instances.erase(std::remove(_instances.begin(), _instances.end(), this), _instances.end());
}
«ENDIF»
«FOR destructor : destructors»
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class OperationTemplates {
'''
«operationSignature(destructor, true, false, false, false)» {
«actionCodeTemplates.generateActionCode(destructor.commonOperation.body)»
_instances.erase(std::find(_instances.begin(), _instances.end(), this));
_instances.erase(std::remove(_instances.begin(), _instances.end(), this), _instances.end());
}
'''
}
Expand Down

0 comments on commit 0948611

Please sign in to comment.