aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-10-30 23:06:04 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-10-30 23:06:04 -0700
commit5f4221420701ff7d78e02b11622a00ee12a8e64a (patch)
tree79eb8b2c760a928a7a1e66f6383dd79d6a19989c /toolsrc/include
parentf8a4d55053561d8ba7e82fa79c45d30ebcb24621 (diff)
downloadvcpkg-5f4221420701ff7d78e02b11622a00ee12a8e64a.tar.gz
vcpkg-5f4221420701ff7d78e02b11622a00ee12a8e64a.zip
[vcpkg] Enable pkg[*] as alias for all features.
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/vcpkg/base/util.h16
-rw-r--r--toolsrc/include/vcpkg/packagespec.h16
-rw-r--r--toolsrc/include/vcpkg/triplet.h1
3 files changed, 33 insertions, 0 deletions
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<class Range>
+ void sort(Range& cont)
+ {
+ using std::begin;
+ using std::end;
+ std::sort(begin(cont), end(cont));
+ }
+
+ template<class Range1, class Range2>
+ 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<class AssocContainer, class K = std::decay_t<decltype(begin(std::declval<AssocContainer>())->first)>>
std::vector<K> 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<FeatureSpec> from_strings_and_triplet(const std::vector<std::string>& 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;