[vcpkg] Simplify code -- Maps::maybe_find is not very useful compared to iterators.
MODIFY
include/vcpkg/base/util.h
include/vcpkg/base/util.h
@@ -31,22 +31,6 @@ namespace vcpkg::Util
}
}
- namespace Maps
- {
- template<class PairType>
- using FirstT = std::remove_reference_t<decltype(std::declval<PairType>().first)>;
-
- template<class Container, class K, class T = FirstT<ElementT<Container>>>
- Optional<T&> maybe_find(Container&& assoc_container, const K& key)
- {
- auto it = assoc_container.find(key);
- if (it == assoc_container.end())
- return nullopt;
- else
- return it->second;
- }
- }
-
template<class Cont, class Func>
using FmapOut = decltype(std::declval<Func&>()(*begin(std::declval<Cont&>())));

MODIFY
src/vcpkg/commands.ci.cpp
src/vcpkg/commands.ci.cpp
@@ -77,10 +77,10 @@ namespace vcpkg::Commands::CI
const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE);
std::set<std::string> exclusions_set;
- auto maybe_exclusions = Util::Maps::maybe_find(options.settings, OPTION_EXCLUDE);
- if (auto p_exclusions = maybe_exclusions.get())
+ auto it_exclusions = options.settings.find(OPTION_EXCLUDE);
+ if (it_exclusions != options.settings.end())
{
- auto exclusions = Strings::split(*p_exclusions, ",");
+ auto exclusions = Strings::split(it_exclusions->second, ",");
exclusions_set.insert(exclusions.begin(), exclusions.end());
}

[vcpkg] Simplify code -- Maps::maybe_find is not very useful compared to iterators.