[PATCH] D141327: [llvm][ADT] Add deduction guides for `MutableArrayRef`

Joe Loser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 10 05:56:25 PST 2023


jloser added inline comments.


================
Comment at: llvm/include/llvm/ADT/ArrayRef.h:590
+  /// Deduction guide to construct a `MutableArrayRef` from a `MutableArrayRef`
+  /// (no-op) (const).
+  template <class T>
----------------
serge-sans-paille wrote:
> I don't think this is going to be a n-op : it's going to call the copy constructor.
Oops, sorry this was a copy-paste from the `makeMutableArrayRef` function template comments.  

Turns out we don't actually need this since a `const MutableArrayRef` would bind with the first deduction guide and give back a `MutableArrayRef<T>`.  I added an additional test to show we can deduce correctly from both a const and non-const `MutableArrayRef` input.

If this still looks good to you @serge-sans-paille, I'll land it.  Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141327/new/

https://reviews.llvm.org/D141327



More information about the llvm-commits mailing list