Template Class MutableArrayRef¶
Defined in File ArrayRef.hpp
Inheritance Relationships¶
Base Type¶
public ams::ArrayRef< T >(Template Class ArrayRef)
Derived Type¶
public ams::OwningArrayRef< T >(Template Class OwningArrayRef)
Class Documentation¶
-
template<typename T>
class MutableArrayRef : public ams::ArrayRef<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.
Subclassed by ams::OwningArrayRef< T >
Public Types
-
using pointer = value_type*¶
-
using const_pointer = const value_type*¶
-
using reference = value_type&¶
-
using const_reference = const value_type&¶
-
using const_iterator = const_pointer¶
-
using const_reverse_iterator = std::reverse_iterator<const_iterator>¶
-
using size_type = size_t¶
-
using difference_type = ptrdiff_t¶
Public Functions
-
MutableArrayRef() = default¶
Construct an empty MutableArrayRef.
-
inline MutableArrayRef(T &OneElt)¶
Construct a MutableArrayRef from a single element.
-
inline MutableArrayRef(T *data, size_t length)¶
Construct a MutableArrayRef from a pointer and length.
-
inline MutableArrayRef(T *begin, T *end)¶
Construct a MutableArrayRef from a range.
-
inline MutableArrayRef(SmallVectorImpl<T> &Vec)¶
Construct a MutableArrayRef from a SmallVector.
-
inline MutableArrayRef(std::vector<T> &Vec)¶
Construct a MutableArrayRef from a std::vector.
-
template<size_t N>
inline constexpr MutableArrayRef(std::array<T, N> &Arr)¶ Construct a MutableArrayRef from a std::array.
-
template<size_t N>
inline constexpr MutableArrayRef(T (&Arr)[N])¶ Construct a MutableArrayRef from a C array.
-
inline reverse_iterator rbegin() const¶
-
inline reverse_iterator rend() const¶
-
inline MutableArrayRef<T> slice(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.
-
inline MutableArrayRef<T> slice(size_t N) const¶
slice(n) - Chop off the first N elements of the array.
-
inline MutableArrayRef<T> drop_front(size_t N = 1) const¶
Drop the first
Nelements of the array.
-
inline MutableArrayRef<T> drop_back(size_t N = 1) const¶
-
template<class PredicateT>
inline MutableArrayRef<T> drop_while(PredicateT Pred) const¶ Return a copy of *this with the first N elements satisfying the given predicate removed.
-
template<class PredicateT>
inline MutableArrayRef<T> drop_until(PredicateT Pred) const¶ Return a copy of *this with the first N elements not satisfying the given predicate removed.
-
inline MutableArrayRef<T> take_front(size_t N = 1) const¶
Return a copy of *this with only the first
Nelements.
-
inline MutableArrayRef<T> take_back(size_t N = 1) const¶
Return a copy of *this with only the last
Nelements.
-
template<class PredicateT>
inline MutableArrayRef<T> take_while(PredicateT Pred) const¶ Return the first N elements of this Array that satisfy the given predicate.
-
template<class PredicateT>
inline MutableArrayRef<T> take_until(PredicateT Pred) const¶ Return the first N elements of this Array that don’t satisfy the given predicate.
-
using pointer = value_type*¶