Skip to content

Commit 5fdd3bf

Browse files
committed
[DenseMap] Use std::remove_cv_t
1 parent a70a2b0 commit 5fdd3bf

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

llvm/include/llvm/ADT/DenseMap.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,8 @@ class DenseMapBase : public DebugEpochBase {
220220
// Return the entry with the specified key, or \p Default. This variant is
221221
// useful, because `lookup` cannot be used with non-default-constructible
222222
// values.
223-
ValueT lookup_or(const_arg_type_t<KeyT> Val, ValueT &&Default) const {
224-
if (const BucketT *Bucket = doFind(Val))
225-
return Bucket->getSecond();
226-
return Default;
227-
}
228-
229-
ValueT lookup_or(const_arg_type_t<KeyT> Val, const ValueT &Default) const {
223+
template <typename U = std::remove_cv_t<ValueT>>
224+
ValueT lookup_or(const_arg_type_t<KeyT> Val, U &&Default) const {
230225
if (const BucketT *Bucket = doFind(Val))
231226
return Bucket->getSecond();
232227
return Default;

0 commit comments

Comments
 (0)