llvm::ArrayRef< T > Class Template Reference

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory), i.e. More...

#include <ArrayRef.h>

List of all members.

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.

Detailed Description

template<typename T>
class llvm::ArrayRef< T >

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.


Member Typedef Documentation

template<typename T>
typedef const T* llvm::ArrayRef< T >::const_iterator
template<typename T>
typedef const T* llvm::ArrayRef< T >::iterator
template<typename T>
typedef size_t llvm::ArrayRef< T >::size_type

Constructor & Destructor Documentation

template<typename T>
llvm::ArrayRef< T >::ArrayRef (  )  [inline]

Construct an empty ArrayRef.

template<typename T>
llvm::ArrayRef< T >::ArrayRef ( const T &  OneElt  )  [inline]

Construct an ArrayRef from a single element.

template<typename T>
llvm::ArrayRef< T >::ArrayRef ( const T *  data,
size_t  length 
) [inline]

Construct an ArrayRef from a pointer and length.

template<typename T>
llvm::ArrayRef< T >::ArrayRef ( const T *  begin,
const T *  end 
) [inline]

Construct an ArrayRef from a range.

template<typename T>
llvm::ArrayRef< T >::ArrayRef ( const SmallVectorImpl< T > &  Vec  )  [inline]

Construct an ArrayRef from a SmallVector.

template<typename T>
llvm::ArrayRef< T >::ArrayRef ( const std::vector< T > &  Vec  )  [inline]

Construct an ArrayRef from a std::vector.

template<typename T>
template<size_t N>
llvm::ArrayRef< T >::ArrayRef ( const T(&)  Arr[N]  )  [inline]

Construct an ArrayRef from a C array.


Member Function Documentation

template<typename T>
const T& llvm::ArrayRef< T >::back (  )  const [inline]

back - Get the last element.

template<typename T>
iterator llvm::ArrayRef< T >::begin (  )  const [inline]
template<typename T>
const T* llvm::ArrayRef< T >::data (  )  const [inline]
template<typename T>
bool llvm::ArrayRef< T >::empty (  )  const [inline]

empty - Check if the array is empty.

template<typename T>
iterator llvm::ArrayRef< T >::end (  )  const [inline]
template<typename T>
bool llvm::ArrayRef< T >::equals ( ArrayRef< T >  RHS  )  const [inline]

equals - Check for element-wise equality.

template<typename T>
const T& llvm::ArrayRef< T >::front (  )  const [inline]

front - Get the first element.

template<typename T>
llvm::ArrayRef< T >::operator std::vector< T > (  )  const [inline]
template<typename T>
const T& llvm::ArrayRef< T >::operator[] ( size_t  Index  )  const [inline]
template<typename T>
size_t llvm::ArrayRef< T >::size (  )  const [inline]

size - Get the array size.

template<typename T>
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.

template<typename T>
ArrayRef<T> llvm::ArrayRef< T >::slice ( unsigned  N  )  [inline]

slice(n) - Chop off the first N elements of the array.

template<typename T>
std::vector<T> llvm::ArrayRef< T >::vec (  )  const [inline]

Member Data Documentation

template<typename T>
const T* llvm::ArrayRef< T >::Data [private]

The start of the array, in an external buffer.

template<typename T>
size_type llvm::ArrayRef< T >::Length [private]

The number of elements.


The documentation for this class was generated from the following file:

Generated on 2 Nov 2013 for Galois by  doxygen 1.6.1