From 7f68aa6630f96f474e85cd332dbbdc1ce6226d50 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 4 Oct 2017 15:50:48 -0700 Subject: [PATCH] Introduce Util::stable_keep_if() --- toolsrc/include/vcpkg_Util.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/toolsrc/include/vcpkg_Util.h b/toolsrc/include/vcpkg_Util.h index c76ca01aca..e5ead6d3af 100644 --- a/toolsrc/include/vcpkg_Util.h +++ b/toolsrc/include/vcpkg_Util.h @@ -37,6 +37,12 @@ namespace vcpkg::Util return ret; } + template + void stable_keep_if(Container& cont, Pred pred) + { + cont.erase(std::stable_partition(cont.begin(), cont.end(), pred), cont.end()); + } + template void unstable_keep_if(Container& cont, Pred pred) {