diff options
-rw-r--r-- | lib/Core/Searcher.cpp | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/lib/Core/Searcher.cpp b/lib/Core/Searcher.cpp index 0dffcf2c..5b9375f9 100644 --- a/lib/Core/Searcher.cpp +++ b/lib/Core/Searcher.cpp @@ -54,18 +54,9 @@ void DFSSearcher::update(ExecutionState *current, if (state == states.back()) { states.pop_back(); } else { - __attribute__((unused)) - bool ok = false; - - for (auto it = states.begin(), ie = states.end(); it != ie; ++it) { - if (state == *it) { - states.erase(it); - ok = true; - break; - } - } - - assert(ok && "invalid state removed"); + auto it = std::find(states.begin(), states.end(), state); + assert(it != states.end() && "invalid state removed"); + states.erase(it); } } } @@ -108,18 +99,9 @@ void BFSSearcher::update(ExecutionState *current, if (state == states.front()) { states.pop_front(); } else { - __attribute__((unused)) - bool ok = false; - - for (auto it = states.begin(), ie = states.end(); it != ie; ++it) { - if (state == *it) { - states.erase(it); - ok = true; - break; - } - } - - assert(ok && "invalid state removed"); + auto it = std::find(states.begin(), states.end(), state); + assert(it != states.end() && "invalid state removed"); + states.erase(it); } } } @@ -149,18 +131,9 @@ void RandomSearcher::update(ExecutionState *current, // remove states for (const auto state : removedStates) { - __attribute__((unused)) - bool ok = false; - - for (auto it = states.begin(), ie = states.end(); it != ie; ++it) { - if (state == *it) { - states.erase(it); - ok = true; - break; - } - } - - assert(ok && "invalid state removed"); + auto it = std::find(states.begin(), states.end(), state); + assert(it != states.end() && "invalid state removed"); + states.erase(it); } } |