Template Class ArrayRef¶
Defined in File ArrayRef.h
Page Contents
Class Documentation¶
-
template<typename T>
class ArrayRef¶ ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory), i.e.
a start pointer and a length. It allows various APIs to take consecutive elements easily and conveniently.
This class does not own the underlying data, it is expected to be used in situations where the data resides in some other buffer, whose lifetime extends past that of the ArrayRef. For this reason, it is not in general safe to store an ArrayRef.
This is intended to be trivially copyable, so it should be passed by value.
Constructors
-
inline constexpr ArrayRef(const T *data, size_t length)¶
Construct an ArrayRef from a pointer and length.
-
template<typename U>
inline ArrayRef(const SmallVectorTemplateCommon<T, U> &Vec)¶ Construct an ArrayRef from a SmallVector.
This is templated in order to avoid instantiating SmallVectorTemplateCommon<T> whenever we copy-construct an ArrayRef.
-
template<typename A>
inline ArrayRef(const std::vector<T, A> &Vec)¶ Construct an ArrayRef from a std::vector.
-
template<size_t N>
inline constexpr ArrayRef(const std::array<T, N> &Arr)¶ Construct an ArrayRef from a std::array.
Simple Operations
-
inline constexpr const_iterator cbegin() const¶
-
inline constexpr const_iterator cend() const¶
-
inline constexpr reverse_iterator rbegin() const¶
-
inline constexpr reverse_iterator rend() const¶
-
inline constexpr bool empty() const¶
empty - Check if the array is empty.
-
inline constexpr size_t size() const¶
size - Get the array size.
-
inline constexpr ArrayRef(const T *data, size_t length)¶