class ArrayRef

Declaration

template <typename T>
class ArrayRef { /* full declaration omitted */ };

Description

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.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:41

Templates

T

Method Overview

  • public template <typename U, typename DummyT> ArrayRef<T>(const SmallVectorTemplateCommon<U *, DummyT> & Vec, typename std::enable_if<std::is_convertible<U *const *, const T *>::value>::type * = nullptr)
  • public ArrayRef<T>()
  • public template <typename U> ArrayRef<T>(const SmallVectorTemplateCommon<T, U> & Vec)
  • public template <typename A> ArrayRef<T>(const std::vector<T, A> & Vec)
  • public template <size_t N>constexpr ArrayRef<T>(const std::array<T, N> & Arr)
  • public template <size_t N>constexpr ArrayRef<T>(const T (&)[N] Arr)
  • public template <typename U> ArrayRef<T>(const ArrayRef<U *> & A, typename std::enable_if<std::is_convertible<U *const *, const T *>::value>::type * = nullptr)
  • public template <typename U, typename A> ArrayRef<T>(const std::vector<U *, A> & Vec, typename std::enable_if<std::is_convertible<U *const *, const T *>::value>::type * = 0)
  • public ArrayRef<T>(const std::initializer_list<T> & Vec)
  • public ArrayRef<T>(const T * begin, const T * end)
  • public ArrayRef<T>(const T * data, size_t length)
  • public ArrayRef<T>(const T & OneElt)
  • public ArrayRef<T>(llvm::NoneType)
  • public const T & back() const
  • public llvm::ArrayRef::iterator begin() const
  • public template <typename Allocator>ArrayRef<T> copy(Allocator & A)
  • public const T * data() const
  • public ArrayRef<T> drop_back(size_t N = 1) const
  • public ArrayRef<T> drop_front(size_t N = 1) const
  • public template <class PredicateT>ArrayRef<T> drop_until(PredicateT Pred) const
  • public template <class PredicateT>ArrayRef<T> drop_while(PredicateT Pred) const
  • public bool empty() const
  • public llvm::ArrayRef::iterator end() const
  • public bool equals(ArrayRef<T> RHS) const
  • public const T & front() const
  • public std::vector<T> operator vector<type-parameter-0-0, allocator<type-parameter-0-0> >() const
  • public llvm::ArrayRef::reverse_iterator rbegin() const
  • public llvm::ArrayRef::reverse_iterator rend() const
  • public size_t size() const
  • public ArrayRef<T> slice(size_t N) const
  • public ArrayRef<T> slice(size_t N, size_t M) const
  • public ArrayRef<T> take_back(size_t N = 1) const
  • public ArrayRef<T> take_front(size_t N = 1) const
  • public template <class PredicateT>ArrayRef<T> take_until(PredicateT Pred) const
  • public template <class PredicateT>ArrayRef<T> take_while(PredicateT Pred) const
  • public std::vector<T> vec() const

Methods

template <typename U, typename DummyT>
ArrayRef<T>(
    const SmallVectorTemplateCommon<U*, DummyT>&
        Vec,
    typename std::enable_if<std::is_convertible<
        U* const*,
        const T*>::value>::type* = nullptr)

Description

Construct an ArrayRef <const T*> from a SmallVector <T *>. This is templated in order to avoid instantiating SmallVectorTemplateCommon <T > whenever we copy-construct an ArrayRef.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:127

Templates

U
DummyT

Parameters

const SmallVectorTemplateCommon<U*, DummyT>& Vec
typename std::enable_if< std::is_convertible<U* const*, const T*>::value>::type* = nullptr

ArrayRef<T>()

Description

Construct an empty ArrayRef.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:60

template <typename U>
ArrayRef<T>(
    const SmallVectorTemplateCommon<T, U>& Vec)

Description

Construct an ArrayRef from a SmallVector. This is templated in order to avoid instantiating SmallVectorTemplateCommon <T > whenever we copy-construct an ArrayRef.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:81

Templates

U

Parameters

const SmallVectorTemplateCommon<T, U>& Vec

template <typename A>
ArrayRef<T>(const std::vector<T, A>& Vec)

Description

Construct an ArrayRef from a std::vector.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:87

Templates

A

Parameters

const std::vector<T, A>& Vec

template <size_t N>
constexpr ArrayRef<T>(const std::array<T, N>& Arr)

Description

Construct an ArrayRef from a std::array

Declared at: llvm/include/llvm/ADT/ArrayRef.h:92

Templates

size_t N

Parameters

const std::array<T, N>& Arr

template <size_t N>
constexpr ArrayRef<T>(const T (&)[N] Arr)

Description

Construct an ArrayRef from a C array.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:97

Templates

size_t N

Parameters

const T (&)[N] Arr

template <typename U>
ArrayRef<T>(
    const ArrayRef<U*>& A,
    typename std::enable_if<std::is_convertible<
        U* const*,
        const T*>::value>::type* = nullptr)

Description

Construct an ArrayRef <const T*> from ArrayRef <T *>. This uses SFINAE to ensure that only ArrayRefs of pointers can be converted.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:117

Templates

U

Parameters

const ArrayRef<U*>& A
typename std::enable_if< std::is_convertible<U* const*, const T*>::value>::type* = nullptr

template <typename U, typename A>
ArrayRef<T>(
    const std::vector<U*, A>& Vec,
    typename std::enable_if<std::is_convertible<
        U* const*,
        const T*>::value>::type* = 0)

Description

Construct an ArrayRef <const T*> from std::vector <T *>. This uses SFINAE to ensure that only vectors of pointers can be converted.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:137

Templates

U
A

Parameters

const std::vector<U*, A>& Vec
typename std::enable_if< std::is_convertible<U* const*, const T*>::value>::type* = 0

ArrayRef<T>(const std::initializer_list<T>& Vec)

Declared at: llvm/include/llvm/ADT/ArrayRef.h:107

Parameters

const std::initializer_list<T>& Vec

ArrayRef<T>(const T* begin, const T* end)

Description

Construct an ArrayRef from a range.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:74

Parameters

const T* begin
const T* end

ArrayRef<T>(const T* data, size_t length)

Description

Construct an ArrayRef from a pointer and length.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:70

Parameters

const T* data
size_t length

ArrayRef<T>(const T& OneElt)

Description

Construct an ArrayRef from a single element.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:66

Parameters

const T& OneElt

ArrayRef<T>(llvm::NoneType)

Description

Construct an empty ArrayRef from None.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:63

Parameters

llvm::NoneType

const T& back() const

Description

back - Get the last element.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:167

llvm::ArrayRef::iterator begin() const

Description

@ } @ {

Declared at: llvm/include/llvm/ADT/ArrayRef.h:146

template <typename Allocator>
ArrayRef<T> copy(Allocator& A)

Declared at: llvm/include/llvm/ADT/ArrayRef.h:173

Templates

Allocator

Parameters

Allocator& A

const T* data() const

Declared at: llvm/include/llvm/ADT/ArrayRef.h:155

ArrayRef<T> drop_back(size_t N = 1) const

Description

Drop the last \p N elements of the array.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:203

Parameters

size_t N = 1

ArrayRef<T> drop_front(size_t N = 1) const

Description

Drop the first \p N elements of the array.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:197

Parameters

size_t N = 1

template <class PredicateT>
ArrayRef<T> drop_until(PredicateT Pred) const

Description

Return a copy of *this with the first N elements not satisfying the given predicate removed.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:216

Templates

PredicateT

Parameters

PredicateT Pred

template <class PredicateT>
ArrayRef<T> drop_while(PredicateT Pred) const

Description

Return a copy of *this with the first N elements satisfying the given predicate removed.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:210

Templates

PredicateT

Parameters

PredicateT Pred

bool empty() const

Description

empty - Check if the array is empty.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:153

llvm::ArrayRef::iterator end() const

Declared at: llvm/include/llvm/ADT/ArrayRef.h:147

bool equals(ArrayRef<T> RHS) const

Description

equals - Check for element-wise equality.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:180

Parameters

ArrayRef<T> RHS

const T& front() const

Description

front - Get the first element.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:161

std::vector<T> operator vector<
    type - parameter - 0 - 0,
    allocator<type - parameter - 0 - 0> >() const

Description

@ } @ {

Declared at: llvm/include/llvm/ADT/ArrayRef.h:280

llvm::ArrayRef::reverse_iterator rbegin() const

Declared at: llvm/include/llvm/ADT/ArrayRef.h:149

llvm::ArrayRef::reverse_iterator rend() const

Declared at: llvm/include/llvm/ADT/ArrayRef.h:150

size_t size() const

Description

size - Get the array size.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:158

ArrayRef<T> slice(size_t N) const

Description

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

Declared at: llvm/include/llvm/ADT/ArrayRef.h:194

Parameters

size_t N

ArrayRef<T> slice(size_t N, size_t M) const

Description

slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:188

Parameters

size_t N
size_t M

ArrayRef<T> take_back(size_t N = 1) const

Description

Return a copy of *this with only the last \p N elements.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:228

Parameters

size_t N = 1

ArrayRef<T> take_front(size_t N = 1) const

Description

Return a copy of *this with only the first \p N elements.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:221

Parameters

size_t N = 1

template <class PredicateT>
ArrayRef<T> take_until(PredicateT Pred) const

Description

Return the first N elements of this Array that don't satisfy the given predicate.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:242

Templates

PredicateT

Parameters

PredicateT Pred

template <class PredicateT>
ArrayRef<T> take_while(PredicateT Pred) const

Description

Return the first N elements of this Array that satisfy the given predicate.

Declared at: llvm/include/llvm/ADT/ArrayRef.h:236

Templates

PredicateT

Parameters

PredicateT Pred

std::vector<T> vec() const

Description

@ } @ {

Declared at: llvm/include/llvm/ADT/ArrayRef.h:273