summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmAlgorithms.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 3dd5f95..f00e1c0 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -239,12 +239,14 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem)
typename Range::iterator writer = r.begin();
std::advance(writer, *remIt);
+ typename Range::iterator pivot = writer;
+ typename InputRange::value_type prevRem = *remIt;
++remIt;
size_t count = 1;
for ( ; writer != r.end() && remIt != rem.end(); ++count, ++remIt)
{
- typename Range::iterator pivot = r.begin();
- std::advance(pivot, *remIt);
+ std::advance(pivot, *remIt - prevRem);
+ prevRem = *remIt;
writer = ContainerAlgorithms::RemoveN(writer, pivot, count);
}
writer = ContainerAlgorithms::RemoveN(writer, r.end(), count);