ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory), i.e. More...
#include <ArrayRef.h>
Public Types | |
typedef const T * | iterator |
typedef const T * | const_iterator |
typedef size_t | size_type |
Public Member Functions | |
Constructors | |
ArrayRef () | |
Construct an empty ArrayRef. | |
ArrayRef (const T &OneElt) | |
Construct an ArrayRef from a single element. | |
ArrayRef (const T *data, size_t length) | |
Construct an ArrayRef from a pointer and length. | |
ArrayRef (const T *begin, const T *end) | |
Construct an ArrayRef from a range. | |
ArrayRef (const SmallVectorImpl< T > &Vec) | |
Construct an ArrayRef from a SmallVector. | |
ArrayRef (const std::vector< T > &Vec) | |
Construct an ArrayRef from a std::vector. | |
template<size_t N> | |
ArrayRef (const T(&Arr)[N]) | |
Construct an ArrayRef from a C array. | |
Simple Operations | |
iterator | begin () const |
iterator | end () const |
bool | empty () const |
empty - Check if the array is empty. | |
const T * | data () const |
size_t | size () const |
size - Get the array size. | |
const T & | front () const |
front - Get the first element. | |
const T & | back () const |
back - Get the last element. | |
bool | equals (ArrayRef RHS) const |
equals - Check for element-wise equality. | |
ArrayRef< T > | slice (unsigned N) |
slice(n) - Chop off the first N elements of the array. | |
ArrayRef< T > | slice (unsigned N, unsigned M) |
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array. | |
Operator Overloads | |
const T & | operator[] (size_t Index) const |
Expensive Operations | |
std::vector< T > | vec () const |
Conversion operators | |
operator std::vector< T > () const | |
Private Attributes | |
const T * | Data |
The start of the array, in an external buffer. | |
size_type | Length |
The number of elements. |
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.
typedef const T* llvm::ArrayRef< T >::const_iterator |
typedef const T* llvm::ArrayRef< T >::iterator |
typedef size_t llvm::ArrayRef< T >::size_type |
llvm::ArrayRef< T >::ArrayRef | ( | ) | [inline] |
Construct an empty ArrayRef.
llvm::ArrayRef< T >::ArrayRef | ( | const T & | OneElt | ) | [inline] |
Construct an ArrayRef from a single element.
llvm::ArrayRef< T >::ArrayRef | ( | const T * | data, | |
size_t | length | |||
) | [inline] |
Construct an ArrayRef from a pointer and length.
llvm::ArrayRef< T >::ArrayRef | ( | const T * | begin, | |
const T * | end | |||
) | [inline] |
Construct an ArrayRef from a range.
llvm::ArrayRef< T >::ArrayRef | ( | const SmallVectorImpl< T > & | Vec | ) | [inline] |
Construct an ArrayRef from a SmallVector.
llvm::ArrayRef< T >::ArrayRef | ( | const std::vector< T > & | Vec | ) | [inline] |
Construct an ArrayRef from a std::vector.
llvm::ArrayRef< T >::ArrayRef | ( | const T(&) | Arr[N] | ) | [inline] |
Construct an ArrayRef from a C array.
const T& llvm::ArrayRef< T >::back | ( | ) | const [inline] |
back - Get the last element.
iterator llvm::ArrayRef< T >::begin | ( | ) | const [inline] |
const T* llvm::ArrayRef< T >::data | ( | ) | const [inline] |
bool llvm::ArrayRef< T >::empty | ( | ) | const [inline] |
empty - Check if the array is empty.
iterator llvm::ArrayRef< T >::end | ( | ) | const [inline] |
bool llvm::ArrayRef< T >::equals | ( | ArrayRef< T > | RHS | ) | const [inline] |
equals - Check for element-wise equality.
const T& llvm::ArrayRef< T >::front | ( | ) | const [inline] |
front - Get the first element.
llvm::ArrayRef< T >::operator std::vector< T > | ( | ) | const [inline] |
const T& llvm::ArrayRef< T >::operator[] | ( | size_t | Index | ) | const [inline] |
size_t llvm::ArrayRef< T >::size | ( | ) | const [inline] |
size - Get the array size.
ArrayRef<T> llvm::ArrayRef< T >::slice | ( | unsigned | N, | |
unsigned | M | |||
) | [inline] |
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
ArrayRef<T> llvm::ArrayRef< T >::slice | ( | unsigned | N | ) | [inline] |
slice(n) - Chop off the first N elements of the array.
std::vector<T> llvm::ArrayRef< T >::vec | ( | ) | const [inline] |
const T* llvm::ArrayRef< T >::Data [private] |
The start of the array, in an external buffer.
size_type llvm::ArrayRef< T >::Length [private] |
The number of elements.