diff options
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/vcpkg/base/util.h | 11 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/build.h | 3 |
2 files changed, 10 insertions, 4 deletions
diff --git a/toolsrc/include/vcpkg/base/util.h b/toolsrc/include/vcpkg/base/util.h index 40022a012..3d32e3aa8 100644 --- a/toolsrc/include/vcpkg/base/util.h +++ b/toolsrc/include/vcpkg/base/util.h @@ -1,6 +1,7 @@ #pragma once #include <algorithm> +#include <functional> #include <map> #include <mutex> #include <type_traits> @@ -121,21 +122,23 @@ namespace vcpkg::Util } } - template<class Range> - void sort(Range& cont) + template<class Range, class Comp = std::less<typename Range::value_type>> + void sort(Range& cont, Comp comp = Comp()) { using std::begin; using std::end; - std::sort(begin(cont), end(cont)); + std::sort(begin(cont), end(cont), comp); } template<class Range> - void sort_unique_erase(Range& cont) + Range&& sort_unique_erase(Range&& cont) { using std::begin; using std::end; std::sort(begin(cont), end(cont)); cont.erase(std::unique(begin(cont), end(cont)), end(cont)); + + return std::forward<Range>(cont); } template<class Range1, class Range2> diff --git a/toolsrc/include/vcpkg/build.h b/toolsrc/include/vcpkg/build.h index cd1821b32..4f6397662 100644 --- a/toolsrc/include/vcpkg/build.h +++ b/toolsrc/include/vcpkg/build.h @@ -270,6 +270,9 @@ namespace vcpkg::Build std::string key; std::string value; + AbiEntry() = default; + AbiEntry(const std::string& key, const std::string& value) : key(key), value(value) {} + bool operator<(const AbiEntry& other) const { return key < other.key || (key == other.key && value < other.value); |
