aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-04-13 15:49:33 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-04-13 15:49:33 -0700
commit46999d38beb6f34f2c484f51e5421a8cabc23a07 (patch)
treed658fa564b0c9139130e4b0b9ce1ad8a4a03af43 /toolsrc/src
parent294159bfd1a25fbffac8051bdf76f2cb88add0fd (diff)
downloadvcpkg-46999d38beb6f34f2c484f51e5421a8cabc23a07.tar.gz
vcpkg-46999d38beb6f34f2c484f51e5421a8cabc23a07.zip
Use Util::erase_remove_if()
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/commands_build.cpp11
-rw-r--r--toolsrc/src/commands_hash.cpp3
-rw-r--r--toolsrc/src/commands_integrate.cpp6
-rw-r--r--toolsrc/src/vcpkg_Dependencies.cpp4
-rw-r--r--toolsrc/src/vcpkg_Strings.cpp6
-rw-r--r--toolsrc/src/vcpkglib.cpp8
6 files changed, 15 insertions, 23 deletions
diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp
index c3ebd7de8..710e108b0 100644
--- a/toolsrc/src/commands_build.cpp
+++ b/toolsrc/src/commands_build.cpp
@@ -10,6 +10,7 @@
#include "metrics.h"
#include "vcpkg_Enums.h"
#include "Paragraphs.h"
+#include "vcpkg_Util.h"
namespace vcpkg::Commands::Build
{
@@ -149,12 +150,10 @@ namespace vcpkg::Commands::Build
if (result == BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES)
{
std::vector<InstallPlanAction> unmet_dependencies = Dependencies::create_install_plan(paths, { spec }, status_db);
- unmet_dependencies.erase(
- std::remove_if(unmet_dependencies.begin(), unmet_dependencies.end(), [&spec](const InstallPlanAction& p)
- {
- return (p.spec == spec) || (p.plan_type == InstallPlanType::ALREADY_INSTALLED);
- }),
- unmet_dependencies.end());
+ Util::erase_remove_if(unmet_dependencies, [&spec](const InstallPlanAction& p)
+ {
+ return (p.spec == spec) || (p.plan_type == InstallPlanType::ALREADY_INSTALLED);
+ });
Checks::check_exit(VCPKG_LINE_INFO, !unmet_dependencies.empty());
System::println(System::Color::error, "The build command requires all dependencies to be already installed.");
diff --git a/toolsrc/src/commands_hash.cpp b/toolsrc/src/commands_hash.cpp
index 2ffa3a9aa..b6355dfbd 100644
--- a/toolsrc/src/commands_hash.cpp
+++ b/toolsrc/src/commands_hash.cpp
@@ -1,6 +1,7 @@
#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
+#include "vcpkg_Util.h"
namespace vcpkg::Commands::Hash
{
@@ -20,7 +21,7 @@ namespace vcpkg::Commands::Hash
Checks::check_exit(VCPKG_LINE_INFO, end != std::string::npos, "Unexpected output format from command: %s", Strings::utf16_to_utf8(cmd_line));
auto hash = output.substr(start, end - start);
- hash.erase(std::remove_if(hash.begin(), hash.end(), isspace), hash.end());
+ Util::erase_remove_if(hash, isspace);
System::println(hash);
}
diff --git a/toolsrc/src/commands_integrate.cpp b/toolsrc/src/commands_integrate.cpp
index 256c3ad1d..ea0682e1f 100644
--- a/toolsrc/src/commands_integrate.cpp
+++ b/toolsrc/src/commands_integrate.cpp
@@ -3,6 +3,7 @@
#include "vcpkg_Checks.h"
#include "vcpkg_System.h"
#include "vcpkg_Files.h"
+#include "vcpkg_Util.h"
namespace vcpkg::Commands::Integrate
{
@@ -66,10 +67,7 @@ namespace vcpkg::Commands::Integrate
dir_id.erase(1, 1); // Erasing the ":"
// NuGet id cannot have invalid characters. We will only use alphanumeric and dot.
- dir_id.erase(std::remove_if(dir_id.begin(), dir_id.end(), [](char c)
- {
- return !isalnum(c) && (c != '.');
- }), dir_id.end());
+ Util::erase_remove_if(dir_id, [](char c) { return !isalnum(c) && (c != '.'); });
const std::string nuget_id = "vcpkg." + dir_id;
return nuget_id;
diff --git a/toolsrc/src/vcpkg_Dependencies.cpp b/toolsrc/src/vcpkg_Dependencies.cpp
index 9ecf57023..cff61b449 100644
--- a/toolsrc/src/vcpkg_Dependencies.cpp
+++ b/toolsrc/src/vcpkg_Dependencies.cpp
@@ -143,10 +143,10 @@ namespace vcpkg::Dependencies
const std::unordered_set<PackageSpec> specs_as_set(specs.cbegin(), specs.cend());
std::vector<InstallPlanAction> toposort = Graphs::topological_sort(specs, InstallAdjacencyProvider{ paths, status_db, specs_as_set });
- toposort.erase(std::remove_if(toposort.begin(), toposort.end(), [](const InstallPlanAction& p)
+ Util::erase_remove_if(toposort, [](const InstallPlanAction& p)
{
return p.request_type == RequestType::AUTO_SELECTED && p.plan_type == InstallPlanType::ALREADY_INSTALLED;
- }), toposort.end());
+ });
return toposort;
}
diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg_Strings.cpp
index 26dc6388b..5f46af6d2 100644
--- a/toolsrc/src/vcpkg_Strings.cpp
+++ b/toolsrc/src/vcpkg_Strings.cpp
@@ -1,5 +1,6 @@
#include "pch.h"
#include "vcpkg_Strings.h"
+#include "vcpkg_Util.h"
namespace vcpkg::Strings::details
{
@@ -98,10 +99,7 @@ namespace vcpkg::Strings
trim(&s);
}
- strings->erase(std::remove_if(strings->begin(), strings->end(), [](const std::string& s)-> bool
- {
- return s == "";
- }), strings->end());
+ Util::erase_remove_if(*strings, [](const std::string& s) { return s == ""; });
}
std::vector<std::string> split(const std::string& s, const std::string& delimiter)
diff --git a/toolsrc/src/vcpkglib.cpp b/toolsrc/src/vcpkglib.cpp
index 5e847019f..253c0c7ea 100644
--- a/toolsrc/src/vcpkglib.cpp
+++ b/toolsrc/src/vcpkglib.cpp
@@ -4,6 +4,7 @@
#include "Paragraphs.h"
#include "metrics.h"
#include "vcpkg_Strings.h"
+#include "vcpkg_Util.h"
namespace vcpkg
{
@@ -201,12 +202,7 @@ namespace vcpkg
upgrade_to_slash_terminated_sorted_format(&installed_files_of_current_pgh, listfile_path);
// Remove the directories
- installed_files_of_current_pgh.erase(
- std::remove_if(installed_files_of_current_pgh.begin(), installed_files_of_current_pgh.end(), [](const std::string& file) -> bool
- {
- return file.back() == '/';
- }
- ), installed_files_of_current_pgh.end());
+ Util::erase_remove_if(installed_files_of_current_pgh, [](const std::string& file) { return file.back() == '/'; });
StatusParagraphAndAssociatedFiles pgh_and_files = { *pgh, SortedVector<std::string>(std::move(installed_files_of_current_pgh)) };
installed_files.push_back(std::move(pgh_and_files));