[llvm] [ArrayRef] Add constructor from iterator_range<U*> (NFC). (PR #137796)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 30 01:02:31 PDT 2025
================
@@ -149,6 +149,13 @@ namespace llvm {
* = nullptr)
: Data(Vec.data()), Length(Vec.size()) {}
+ /// Construct an ArrayRef<T> from iterator_range<U*>. This uses SFINAE
+ /// to ensure that this is only used for iterator ranges over plain pointer
+ /// iterators.
+ template <typename U, typename = std::enable_if_t<std::is_same_v<U *, T *>>>
----------------
artagnon wrote:
Sorry about the thinko, but why is template parameter U needed if `std::is_same_iv<U *, T *>`? Doesn't that imply that U = T?
https://github.com/llvm/llvm-project/pull/137796
More information about the llvm-commits
mailing list