serge-sans-paille updated this revision to Diff 486172.
serge-sans-paille added a comment.

Split the original patch in pieces: first just introduce the deduction guide.


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

https://reviews.llvm.org/D140896

Files:
  llvm/include/llvm/ADT/ArrayRef.h


Index: llvm/include/llvm/ADT/ArrayRef.h
===================================================================
--- llvm/include/llvm/ADT/ArrayRef.h
+++ llvm/include/llvm/ADT/ArrayRef.h
@@ -466,9 +466,44 @@
     ~OwningArrayRef() { delete[] this->data(); }
   };
 
-  /// @name ArrayRef Convenience constructors
+  /// @name ArrayRef Deduction guides
   /// @{
+  /// Deduction guide to construct an ArrayRef from a single element.
+  template <typename T> ArrayRef(const T &OneElt) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from a pointer and length
+  template <typename T> ArrayRef(const T *data, size_t length) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from a range
+  template <typename T> ArrayRef(const T *data, const T *end) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from a SmallVector
+  template <typename T> ArrayRef(const SmallVectorImpl<T> &Vec) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from a SmallVector
+  template <typename T, unsigned N>
+  ArrayRef(const SmallVector<T, N> &Vec) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from a std::vector
+  template <typename T> ArrayRef(const std::vector<T> &Vec) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from a std::array
+  template <typename T, std::size_t N>
+  ArrayRef(const std::array<T, N> &Vec) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op) (const)
+  template <typename T> ArrayRef(const ArrayRef<T> &Vec) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op)
+  template <typename T> ArrayRef(ArrayRef<T> &Vec) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from a C array.
+  template <typename T, size_t N> ArrayRef(const T (&Arr)[N]) -> ArrayRef<T>;
 
+  /// @}
+
+  /// @name ArrayRef Convenience constructors
+  /// @{
   /// Construct an ArrayRef from a single element.
   template<typename T>
   ArrayRef<T> makeArrayRef(const T &OneElt) {


Index: llvm/include/llvm/ADT/ArrayRef.h
===================================================================
--- llvm/include/llvm/ADT/ArrayRef.h
+++ llvm/include/llvm/ADT/ArrayRef.h
@@ -466,9 +466,44 @@
     ~OwningArrayRef() { delete[] this->data(); }
   };
 
-  /// @name ArrayRef Convenience constructors
+  /// @name ArrayRef Deduction guides
   /// @{
+  /// Deduction guide to construct an ArrayRef from a single element.
+  template <typename T> ArrayRef(const T &OneElt) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from a pointer and length
+  template <typename T> ArrayRef(const T *data, size_t length) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from a range
+  template <typename T> ArrayRef(const T *data, const T *end) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from a SmallVector
+  template <typename T> ArrayRef(const SmallVectorImpl<T> &Vec) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from a SmallVector
+  template <typename T, unsigned N>
+  ArrayRef(const SmallVector<T, N> &Vec) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from a std::vector
+  template <typename T> ArrayRef(const std::vector<T> &Vec) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from a std::array
+  template <typename T, std::size_t N>
+  ArrayRef(const std::array<T, N> &Vec) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op) (const)
+  template <typename T> ArrayRef(const ArrayRef<T> &Vec) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op)
+  template <typename T> ArrayRef(ArrayRef<T> &Vec) -> ArrayRef<T>;
+
+  /// Deduction guide to construct an ArrayRef from a C array.
+  template <typename T, size_t N> ArrayRef(const T (&Arr)[N]) -> ArrayRef<T>;
 
+  /// @}
+
+  /// @name ArrayRef Convenience constructors
+  /// @{
   /// Construct an ArrayRef from a single element.
   template<typename T>
   ArrayRef<T> makeArrayRef(const T &OneElt) {
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to