summaryrefslogtreecommitdiffstats
path: root/Source/cmAlgorithms.h
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2017-02-10 22:04:32 (GMT)
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2017-02-10 22:04:32 (GMT)
commitc3800e54583208ac4a6435884bb8832e72af3183 (patch)
tree12e2b0c67f170e1521cb013b79becc0c419e1a5a /Source/cmAlgorithms.h
parentee3295e91740033ebe9d9a0c800c0a3070108624 (diff)
downloadCMake-c3800e54583208ac4a6435884bb8832e72af3183.zip
CMake-c3800e54583208ac4a6435884bb8832e72af3183.tar.gz
CMake-c3800e54583208ac4a6435884bb8832e72af3183.tar.bz2
cmAlgorithms: add cmEraseIf function
Diffstat (limited to 'Source/cmAlgorithms.h')
-rw-r--r--Source/cmAlgorithms.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 7c683ad..f5469e5 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -101,6 +101,12 @@ FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last)
return first;
}
+template <typename Container, typename Predicate>
+void cmEraseIf(Container& cont, Predicate pred)
+{
+ cont.erase(std::remove_if(cont.begin(), cont.end(), pred), cont.end());
+}
+
namespace ContainerAlgorithms {
template <typename T>