MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / erase_if

Method erase_if

lib/programmemory.cpp:192–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192void ProgramMemory::erase_if(const std::function<bool(const ExprIdToken&)>& pred)
193{
194 if (mValues->empty())
195 return;
196
197 // TODO: how to delay until we actually modify?
198 copyOnWrite();
199
200 for (auto it = mValues->begin(); it != mValues->end();) {
201 if (pred(it->first))
202 it = mValues->erase(it);
203 else
204 ++it;
205 }
206}
207
208void ProgramMemory::swap(ProgramMemory &pm) noexcept
209{

Callers 2

removeModifiedVarsFunction · 0.80
removeModifiedVarsMethod · 0.80

Calls 4

emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected