aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-10-04 15:50:48 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-10-05 18:27:07 -0700
commit7f68aa6630f96f474e85cd332dbbdc1ce6226d50 (patch)
treea4912fc4e1904e297b81c69b079da25815f62f71
parent68a9876682f3eb4118b378a30be7b8fa6569da11 (diff)
downloadvcpkg-7f68aa6630f96f474e85cd332dbbdc1ce6226d50.tar.gz
vcpkg-7f68aa6630f96f474e85cd332dbbdc1ce6226d50.zip
Introduce Util::stable_keep_if()
-rw-r--r--toolsrc/include/vcpkg_Util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/toolsrc/include/vcpkg_Util.h b/toolsrc/include/vcpkg_Util.h
index c76ca01ac..e5ead6d3a 100644
--- a/toolsrc/include/vcpkg_Util.h
+++ b/toolsrc/include/vcpkg_Util.h
@@ -38,6 +38,12 @@ namespace vcpkg::Util
}
template<class Container, class Pred>
+ void stable_keep_if(Container& cont, Pred pred)
+ {
+ cont.erase(std::stable_partition(cont.begin(), cont.end(), pred), cont.end());
+ }
+
+ template<class Container, class Pred>
void unstable_keep_if(Container& cont, Pred pred)
{
cont.erase(std::partition(cont.begin(), cont.end(), pred), cont.end());