diff options
Diffstat (limited to 'util/generic/algorithm.h')
-rw-r--r-- | util/generic/algorithm.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h index f910c79b1a..bce242679f 100644 --- a/util/generic/algorithm.h +++ b/util/generic/algorithm.h @@ -729,6 +729,13 @@ constexpr bool IsSortedBy(TIterator begin, TIterator end, const TGetKey& getKey) return IsSorted(begin, end, [&](auto&& left, auto&& right) { return getKey(left) < getKey(right); }); } +template <class TContainer, typename TGetKey> +constexpr bool IsSortedBy(const TContainer& c, const TGetKey& getKey) { + using std::begin; + using std::end; + return IsSortedBy(begin(c), end(c), getKey); +} + template <class It, class Val> constexpr void Iota(It begin, It end, Val val) { std::iota(begin, end, val); |