diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-02-20 21:07:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-02-24 14:16:02 (GMT) |
commit | 1f7967913662429adcc509528086d6525acff317 (patch) | |
tree | 69e281a2ae95dacd7f78d08d14a00b34f468cc58 /Source/cmAlgorithms.h | |
parent | ba959934a6a832e7d0a9f4bfc433e09aad1476f3 (diff) | |
download | CMake-1f7967913662429adcc509528086d6525acff317.zip CMake-1f7967913662429adcc509528086d6525acff317.tar.gz CMake-1f7967913662429adcc509528086d6525acff317.tar.bz2 |
cmAlgorithms: Relax iterator requirement for cmRemoveIndices.
Require only forward iterators from the range.
Diffstat (limited to 'Source/cmAlgorithms.h')
-rw-r--r-- | Source/cmAlgorithms.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 161a2cb..3dd5f95 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -237,12 +237,15 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem) { typename InputRange::const_iterator remIt = rem.begin(); - typename Range::iterator writer = r.begin() + *remIt; + typename Range::iterator writer = r.begin(); + std::advance(writer, *remIt); ++remIt; size_t count = 1; for ( ; writer != r.end() && remIt != rem.end(); ++count, ++remIt) { - writer = ContainerAlgorithms::RemoveN(writer, r.begin() + *remIt, count); + typename Range::iterator pivot = r.begin(); + std::advance(pivot, *remIt); + writer = ContainerAlgorithms::RemoveN(writer, pivot, count); } writer = ContainerAlgorithms::RemoveN(writer, r.end(), count); return writer; |