From 5f4221420701ff7d78e02b11622a00ee12a8e64a Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Mon, 30 Oct 2017 23:06:04 -0700 Subject: [vcpkg] Enable pkg[*] as alias for all features. --- toolsrc/include/vcpkg/base/util.h | 16 ++++++++++++++++ toolsrc/include/vcpkg/packagespec.h | 16 ++++++++++++++++ toolsrc/include/vcpkg/triplet.h | 1 + 3 files changed, 33 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/util.h b/toolsrc/include/vcpkg/base/util.h index 7ffd027f0..e67d38ad8 100644 --- a/toolsrc/include/vcpkg/base/util.h +++ b/toolsrc/include/vcpkg/base/util.h @@ -117,6 +117,22 @@ namespace vcpkg::Util } } + template + void sort(Range& cont) + { + using std::begin; + using std::end; + std::sort(begin(cont), end(cont)); + } + + template + bool all_equal(const Range1& r1, const Range2& r2) + { + using std::begin; + using std::end; + return std::equal(begin(r1), end(r1), begin(r2), end(r2)); + } + template())->first)>> std::vector extract_keys(AssocContainer&& input_map) { diff --git a/toolsrc/include/vcpkg/packagespec.h b/toolsrc/include/vcpkg/packagespec.h index 99aaaf0d7..0487ae6b8 100644 --- a/toolsrc/include/vcpkg/packagespec.h +++ b/toolsrc/include/vcpkg/packagespec.h @@ -50,6 +50,22 @@ namespace vcpkg static std::vector from_strings_and_triplet(const std::vector& depends, const Triplet& t); + bool operator<(const FeatureSpec& other) const + { + if (name() < other.name()) return true; + if (name() > other.name()) return false; + if (feature() < other.feature()) return true; + if (feature() > other.feature()) return false; + return triplet() < other.triplet(); + } + + bool operator==(const FeatureSpec& other) const + { + return triplet() == other.triplet() && name() == other.name() && feature() == other.feature(); + } + + bool operator!=(const FeatureSpec& other) const { return !(*this == other); } + private: PackageSpec m_spec; std::string m_feature; diff --git a/toolsrc/include/vcpkg/triplet.h b/toolsrc/include/vcpkg/triplet.h index 50d731593..2cfc2d02a 100644 --- a/toolsrc/include/vcpkg/triplet.h +++ b/toolsrc/include/vcpkg/triplet.h @@ -24,6 +24,7 @@ namespace vcpkg size_t hash_code() const; bool operator==(const Triplet& other) const; + bool operator<(const Triplet& other) const { return canonical_name() < other.canonical_name(); } private: static const TripletInstance DEFAULT_INSTANCE; -- cgit v1.2.3