From e4571e75c2e572ef6a9f094bdd00326f8711e195 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 16 Dec 2016 17:48:37 -0800 Subject: Do the trim and empty string erase in separate passes --- toolsrc/src/vcpkg_Strings.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'toolsrc/src') diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg_Strings.cpp index 403900dae..d2e153ede 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg_Strings.cpp @@ -109,9 +109,13 @@ namespace vcpkg {namespace Strings void trim_all_and_remove_whitespace_strings(std::vector* strings) { - strings->erase(std::remove_if(strings->begin(), strings->end(), [](std::string& s)-> bool + for (std::string& s : *strings) + { + trim(&s); + } + + strings->erase(std::remove_if(strings->begin(), strings->end(), [](const std::string& s)-> bool { - trim(&s); return s == ""; }), strings->end()); } -- cgit v1.2.3