Skip to content

Commit 6a06181

Browse files
committed
[MapVector] Use make_(first|second)_range
1 parent c19124a commit 6a06181

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

llvm/include/llvm/ADT/MapVector.h

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,10 @@ class MapVector {
9999
return try_emplace_impl(Key).first->second;
100100
}
101101

102-
[[nodiscard]] inline auto keys() {
103-
return map_range(
104-
Vector, [](const std::pair<KeyT, ValueT> &KV) { return KV.first; });
105-
}
106-
107-
[[nodiscard]] inline auto values() {
108-
return map_range(
109-
Vector, [](const std::pair<KeyT, ValueT> &KV) { return KV.second; });
110-
}
111-
112-
[[nodiscard]] inline auto keys() const {
113-
return map_range(
114-
Vector, [](const std::pair<KeyT, ValueT> &KV) { return KV.first; });
115-
}
116-
117-
[[nodiscard]] inline auto values() const {
118-
return map_range(
119-
Vector, [](const std::pair<KeyT, ValueT> &KV) { return KV.second; });
120-
}
102+
[[nodiscard]] inline auto keys() { return make_first_range(Vector); }
103+
[[nodiscard]] inline auto values() { return make_second_range(Vector); }
104+
[[nodiscard]] inline auto keys() const { return make_first_range(Vector); }
105+
[[nodiscard]] inline auto values() const { return make_second_range(Vector); }
121106

122107
// Returns a copy of the value. Only allowed if ValueT is copyable.
123108
[[nodiscard]] ValueT lookup(const KeyT &Key) const {

0 commit comments

Comments
 (0)