LLVM  8.0.1
Public Types | Public Member Functions | List of all members
llvm::MutableArrayRef< T > Class Template Reference

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

#include "llvm/ADT/ArrayRef.h"

Inheritance diagram for llvm::MutableArrayRef< T >:
Inheritance graph
[legend]
Collaboration diagram for llvm::MutableArrayRef< T >:
Collaboration graph
[legend]

Public Types

using iterator = T *
 
using reverse_iterator = std::reverse_iterator< iterator >
 
- Public Types inherited from llvm::ArrayRef< T >
using iterator = const T *
 
using const_iterator = const T *
 
using size_type = size_t
 
using reverse_iterator = std::reverse_iterator< iterator >
 

Public Member Functions

 MutableArrayRef ()=default
 Construct an empty MutableArrayRef. More...
 
 MutableArrayRef (NoneType)
 Construct an empty MutableArrayRef from None. More...
 
 MutableArrayRef (T &OneElt)
 Construct an MutableArrayRef from a single element. More...
 
 MutableArrayRef (T *data, size_t length)
 Construct an MutableArrayRef from a pointer and length. More...
 
 MutableArrayRef (T *begin, T *end)
 Construct an MutableArrayRef from a range. More...
 
 MutableArrayRef (SmallVectorImpl< T > &Vec)
 Construct an MutableArrayRef from a SmallVector. More...
 
 MutableArrayRef (std::vector< T > &Vec)
 Construct a MutableArrayRef from a std::vector. More...
 
template<size_t N>
constexpr MutableArrayRef (std::array< T, N > &Arr)
 Construct an ArrayRef from a std::array. More...
 
template<size_t N>
constexpr MutableArrayRef (T(&Arr)[N])
 Construct an MutableArrayRef from a C array. More...
 
Tdata () const
 
iterator begin () const
 
iterator end () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 
Tfront () const
 front - Get the first element. More...
 
Tback () const
 back - Get the last element. More...
 
MutableArrayRef< Tslice (size_t N, size_t M) const
 slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array. More...
 
MutableArrayRef< Tslice (size_t N) const
 slice(n) - Chop off the first N elements of the array. More...
 
MutableArrayRef< Tdrop_front (size_t N=1) const
 Drop the first N elements of the array. More...
 
MutableArrayRef< Tdrop_back (size_t N=1) const
 
template<class PredicateT >
MutableArrayRef< Tdrop_while (PredicateT Pred) const
 Return a copy of *this with the first N elements satisfying the given predicate removed. More...
 
template<class PredicateT >
MutableArrayRef< Tdrop_until (PredicateT Pred) const
 Return a copy of *this with the first N elements not satisfying the given predicate removed. More...
 
MutableArrayRef< Ttake_front (size_t N=1) const
 Return a copy of *this with only the first N elements. More...
 
MutableArrayRef< Ttake_back (size_t N=1) const
 Return a copy of *this with only the last N elements. More...
 
template<class PredicateT >
MutableArrayRef< Ttake_while (PredicateT Pred) const
 Return the first N elements of this Array that satisfy the given predicate. More...
 
template<class PredicateT >
MutableArrayRef< Ttake_until (PredicateT Pred) const
 Return the first N elements of this Array that don't satisfy the given predicate. More...
 
Operator Overloads
Toperator[] (size_t Index) const
 
- Public Member Functions inherited from llvm::ArrayRef< T >
 ArrayRef ()=default
 Construct an empty ArrayRef. More...
 
 ArrayRef (NoneType)
 Construct an empty ArrayRef from None. More...
 
 ArrayRef (const T &OneElt)
 Construct an ArrayRef from a single element. More...
 
 ArrayRef (const T *data, size_t length)
 Construct an ArrayRef from a pointer and length. More...
 
 ArrayRef (const T *begin, const T *end)
 Construct an ArrayRef from a range. More...
 
template<typename U >
 ArrayRef (const SmallVectorTemplateCommon< T, U > &Vec)
 Construct an ArrayRef from a SmallVector. More...
 
template<typename A >
 ArrayRef (const std::vector< T, A > &Vec)
 Construct an ArrayRef from a std::vector. More...
 
template<size_t N>
constexpr ArrayRef (const std::array< T, N > &Arr)
 Construct an ArrayRef from a std::array. More...
 
template<size_t N>
constexpr ArrayRef (const T(&Arr)[N])
 Construct an ArrayRef from a C array. More...
 
 ArrayRef (const std::initializer_list< T > &Vec)
 Construct an ArrayRef from a std::initializer_list. More...
 
template<typename U >
 ArrayRef (const ArrayRef< U *> &A, typename std::enable_if< std::is_convertible< U *const *, T const *>::value >::type *=nullptr)
 Construct an ArrayRef<const T*> from ArrayRef<T*>. More...
 
template<typename U , typename DummyT >
 ArrayRef (const SmallVectorTemplateCommon< U *, DummyT > &Vec, typename std::enable_if< std::is_convertible< U *const *, T const *>::value >::type *=nullptr)
 Construct an ArrayRef<const T*> from a SmallVector<T*>. More...
 
template<typename U , typename A >
 ArrayRef (const std::vector< U *, A > &Vec, typename std::enable_if< std::is_convertible< U *const *, T const *>::value >::type *=0)
 Construct an ArrayRef<const T*> from std::vector<T*>. More...
 
iterator begin () const
 
iterator end () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 
bool empty () const
 empty - Check if the array is empty. More...
 
const Tdata () const
 
size_t size () const
 size - Get the array size. More...
 
const Tfront () const
 front - Get the first element. More...
 
const Tback () const
 back - Get the last element. More...
 
template<typename Allocator >
ArrayRef< Tcopy (Allocator &A)
 
bool equals (ArrayRef RHS) const
 equals - Check for element-wise equality. More...
 
ArrayRef< Tslice (size_t N, size_t M) const
 slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array. More...
 
ArrayRef< Tslice (size_t N) const
 slice(n) - Chop off the first N elements of the array. More...
 
ArrayRef< Tdrop_front (size_t N=1) const
 Drop the first N elements of the array. More...
 
ArrayRef< Tdrop_back (size_t N=1) const
 Drop the last N elements of the array. More...
 
template<class PredicateT >
ArrayRef< Tdrop_while (PredicateT Pred) const
 Return a copy of *this with the first N elements satisfying the given predicate removed. More...
 
template<class PredicateT >
ArrayRef< Tdrop_until (PredicateT Pred) const
 Return a copy of *this with the first N elements not satisfying the given predicate removed. More...
 
ArrayRef< Ttake_front (size_t N=1) const
 Return a copy of *this with only the first N elements. More...
 
ArrayRef< Ttake_back (size_t N=1) const
 Return a copy of *this with only the last N elements. More...
 
template<class PredicateT >
ArrayRef< Ttake_while (PredicateT Pred) const
 Return the first N elements of this Array that satisfy the given predicate. More...
 
template<class PredicateT >
ArrayRef< Ttake_until (PredicateT Pred) const
 Return the first N elements of this Array that don't satisfy the given predicate. More...
 
const Toperator[] (size_t Index) const
 
template<typename U >
std::enable_if< std::is_same< U, T >::value, ArrayRef< T > >::typeoperator= (U &&Temporary)=delete
 Disallow accidental assignment from a temporary. More...
 
template<typename U >
std::enable_if< std::is_same< U, T >::value, ArrayRef< T > >::typeoperator= (std::initializer_list< U >)=delete
 Disallow accidental assignment from a temporary. More...
 
std::vector< Tvec () const
 
 operator std::vector< T > () const
 

Detailed Description

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

MutableArrayRef - Represent a mutable 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 and modify 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 MutableArrayRef. For this reason, it is not in general safe to store a MutableArrayRef.

This is intended to be trivially copyable, so it should be passed by value.

Definition at line 291 of file ArrayRef.h.

Member Typedef Documentation

◆ iterator

template<typename T>
using llvm::MutableArrayRef< T >::iterator = T *

Definition at line 293 of file ArrayRef.h.

◆ reverse_iterator

template<typename T>
using llvm::MutableArrayRef< T >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 294 of file ArrayRef.h.

Constructor & Destructor Documentation

◆ MutableArrayRef() [1/9]

template<typename T>
llvm::MutableArrayRef< T >::MutableArrayRef ( )
default

Construct an empty MutableArrayRef.

◆ MutableArrayRef() [2/9]

template<typename T>
llvm::MutableArrayRef< T >::MutableArrayRef ( NoneType  )
inline

Construct an empty MutableArrayRef from None.

Definition at line 300 of file ArrayRef.h.

◆ MutableArrayRef() [3/9]

template<typename T>
llvm::MutableArrayRef< T >::MutableArrayRef ( T OneElt)
inline

Construct an MutableArrayRef from a single element.

Definition at line 303 of file ArrayRef.h.

◆ MutableArrayRef() [4/9]

template<typename T>
llvm::MutableArrayRef< T >::MutableArrayRef ( T data,
size_t  length 
)
inline

Construct an MutableArrayRef from a pointer and length.

Definition at line 306 of file ArrayRef.h.

◆ MutableArrayRef() [5/9]

template<typename T>
llvm::MutableArrayRef< T >::MutableArrayRef ( T begin,
T end 
)
inline

Construct an MutableArrayRef from a range.

Definition at line 310 of file ArrayRef.h.

◆ MutableArrayRef() [6/9]

template<typename T>
llvm::MutableArrayRef< T >::MutableArrayRef ( SmallVectorImpl< T > &  Vec)
inline

Construct an MutableArrayRef from a SmallVector.

Definition at line 313 of file ArrayRef.h.

◆ MutableArrayRef() [7/9]

template<typename T>
llvm::MutableArrayRef< T >::MutableArrayRef ( std::vector< T > &  Vec)
inline

Construct a MutableArrayRef from a std::vector.

Definition at line 317 of file ArrayRef.h.

◆ MutableArrayRef() [8/9]

template<typename T>
template<size_t N>
constexpr llvm::MutableArrayRef< T >::MutableArrayRef ( std::array< T, N > &  Arr)
inline

Construct an ArrayRef from a std::array.

Definition at line 322 of file ArrayRef.h.

◆ MutableArrayRef() [9/9]

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

Construct an MutableArrayRef from a C array.

Definition at line 327 of file ArrayRef.h.

Member Function Documentation

◆ back()

template<typename T>
T& llvm::MutableArrayRef< T >::back ( ) const
inline

back - Get the last element.

Definition at line 344 of file ArrayRef.h.

◆ begin()

template<typename T>
iterator llvm::MutableArrayRef< T >::begin ( ) const
inline

◆ data()

template<typename T>
T* llvm::MutableArrayRef< T >::data ( ) const
inline

◆ drop_back()

template<typename T>
MutableArrayRef<T> llvm::MutableArrayRef< T >::drop_back ( size_t  N = 1) const
inline

Definition at line 367 of file ArrayRef.h.

Referenced by llvm::BitVector::clearBitsNotInMask().

◆ drop_front()

template<typename T>
MutableArrayRef<T> llvm::MutableArrayRef< T >::drop_front ( size_t  N = 1) const
inline

Drop the first N elements of the array.

Definition at line 362 of file ArrayRef.h.

Referenced by llvm::BitVector::clearBitsNotInMask(), and llvm::BitVector::resize().

◆ drop_until()

template<typename T>
template<class PredicateT >
MutableArrayRef<T> llvm::MutableArrayRef< T >::drop_until ( PredicateT  Pred) const
inline

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

Definition at line 382 of file ArrayRef.h.

◆ drop_while()

template<typename T>
template<class PredicateT >
MutableArrayRef<T> llvm::MutableArrayRef< T >::drop_while ( PredicateT  Pred) const
inline

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

Definition at line 375 of file ArrayRef.h.

◆ end()

template<typename T>
iterator llvm::MutableArrayRef< T >::end ( ) const
inline

Definition at line 332 of file ArrayRef.h.

Referenced by FitWeights(), lowerV8I16GeneralSingleInputVectorShuffle(), and toUTF8().

◆ front()

template<typename T>
T& llvm::MutableArrayRef< T >::front ( ) const
inline

front - Get the first element.

Definition at line 338 of file ArrayRef.h.

◆ operator[]()

template<typename T>
T& llvm::MutableArrayRef< T >::operator[] ( size_t  Index) const
inline

Definition at line 417 of file ArrayRef.h.

◆ rbegin()

template<typename T>
reverse_iterator llvm::MutableArrayRef< T >::rbegin ( ) const
inline

Definition at line 334 of file ArrayRef.h.

◆ rend()

template<typename T>
reverse_iterator llvm::MutableArrayRef< T >::rend ( ) const
inline

Definition at line 335 of file ArrayRef.h.

◆ slice() [1/2]

template<typename T>
MutableArrayRef<T> llvm::MutableArrayRef< T >::slice ( size_t  N,
size_t  M 
) const
inline

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

Definition at line 351 of file ArrayRef.h.

Referenced by lowerV8I16GeneralSingleInputVectorShuffle(), multikeySort(), and llvm::codeview::ContinuationRecordBuilder::writeMemberType().

◆ slice() [2/2]

template<typename T>
MutableArrayRef<T> llvm::MutableArrayRef< T >::slice ( size_t  N) const
inline

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

Definition at line 357 of file ArrayRef.h.

◆ take_back()

template<typename T>
MutableArrayRef<T> llvm::MutableArrayRef< T >::take_back ( size_t  N = 1) const
inline

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

Definition at line 394 of file ArrayRef.h.

Referenced by llvm::codeview::ContinuationRecordBuilder::writeMemberType().

◆ take_front()

template<typename T>
MutableArrayRef<T> llvm::MutableArrayRef< T >::take_front ( size_t  N = 1) const
inline

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

Definition at line 387 of file ArrayRef.h.

Referenced by llvm::BitVector::clearBitsNotInMask().

◆ take_until()

template<typename T>
template<class PredicateT >
MutableArrayRef<T> llvm::MutableArrayRef< T >::take_until ( PredicateT  Pred) const
inline

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

Definition at line 410 of file ArrayRef.h.

◆ take_while()

template<typename T>
template<class PredicateT >
MutableArrayRef<T> llvm::MutableArrayRef< T >::take_while ( PredicateT  Pred) const
inline

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

Definition at line 403 of file ArrayRef.h.


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