mirror of https://github.com/microsoft/vcpkg.git
Use Util::find_if/not()
This commit is contained in:
parent
66017aa2c3
commit
392b3a50ea
|
|
@ -1,5 +1,6 @@
|
|||
#include "pch.h"
|
||||
#include "PackageSpec.h"
|
||||
#include "vcpkg_Util.h"
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
|
|
@ -29,7 +30,7 @@ namespace vcpkg
|
|||
|
||||
Expected<PackageSpec> PackageSpec::from_name_and_triplet(const std::string& name, const Triplet& triplet)
|
||||
{
|
||||
if (std::find_if_not(name.cbegin(), name.cend(), is_valid_package_spec_char) != name.end())
|
||||
if (Util::find_if_not(name, is_valid_package_spec_char) != name.end())
|
||||
{
|
||||
return std::error_code(PackageSpecParseResult::INVALID_CHARACTERS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace vcpkg
|
|||
|
||||
static Optional<fs::path> find_if_has_equal_or_greater_version(const std::vector<fs::path>& candidate_paths, const std::wstring& version_check_arguments, const std::array<int, 3>& expected_version)
|
||||
{
|
||||
auto it = std::find_if(candidate_paths.cbegin(), candidate_paths.cend(), [&](const fs::path& p)
|
||||
auto it = Util::find_if(candidate_paths, [&](const fs::path& p)
|
||||
{
|
||||
const std::wstring cmd = Strings::wformat(LR"("%s" %s)", p.native(), version_check_arguments);
|
||||
return exists_and_has_equal_or_greater_version(cmd, expected_version);
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ namespace vcpkg::Commands::Install
|
|||
|
||||
print_plan(install_plan);
|
||||
|
||||
const bool has_non_user_requested_packages = std::find_if(install_plan.cbegin(), install_plan.cend(), [](const InstallPlanAction& package)-> bool
|
||||
const bool has_non_user_requested_packages = Util::find_if(install_plan, [](const InstallPlanAction& package)-> bool
|
||||
{
|
||||
return package.request_type != RequestType::USER_REQUESTED;
|
||||
}) != install_plan.cend();
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ namespace vcpkg::Commands::Remove
|
|||
|
||||
print_plan(remove_plan);
|
||||
|
||||
const bool has_non_user_requested_packages = std::find_if(remove_plan.cbegin(), remove_plan.cend(), [](const RemovePlanAction& package)-> bool
|
||||
const bool has_non_user_requested_packages = Util::find_if(remove_plan, [](const RemovePlanAction& package)-> bool
|
||||
{
|
||||
return package.request_type != RequestType::USER_REQUESTED;
|
||||
}) != remove_plan.cend();
|
||||
|
|
|
|||
Loading…
Reference in New Issue