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.

Synopsis

Declared in <llvm/ADT/ArrayRef.h>

template<typename T>
class [[nodiscard]] MutableArrayRef
    : public ArrayRef<T>

Description

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.

Base Classes

Name

Description

ArrayRef<T>

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.

Type Aliases

Name

Description

const_iterator

Const iterator over the referenced array elements.

const_pointer

Pointer to a const element.

const_reference

Const reference to an element.

const_reverse_iterator

Const reverse iterator over the referenced array elements.

difference_type

Signed type used to express the distance between iterators.

iterator

Iterator over the referenced array elements.

pointer

Mutable pointer to an element.

reference

Mutable reference to an element.

reverse_iterator

Reverse iterator over the referenced array elements.

size_type

Unsigned type used to express the size of the array.

value_type

Element type stored in the referenced array.

Member Functions

Name

Description

MutableArrayRef [constructor]

Constructors

operator=

Disallow accidental assignment from a temporary.

back

Get the last element.

begin

Iterator to the first mutable element.

consume_back

Returns the last element and drops it from ArrayRef.

consume_front

Returns the first element and drops it from ArrayRef.

copy

Allocate a mutable copy in A and return a reference to it.

data

Return a mutable pointer to the start of the array.

drop_back

Drop the last N elements of the array.

drop_front

Drop the first N elements of the array.

drop_until

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

drop_while

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

empty

Check if the array is empty.

end

Iterator one past the last mutable element.

equals

Check for element‐wise equality.

front

Get the first element.

operator[]

@}

rbegin

Return a reverse iterator to the last mutable element.

rend

Return a reverse iterator to the element before the first element.

size

Get the array size.

slice

slice overloads

take_back

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

take_front

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

take_until

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

take_while

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

vec

@}

operator std::vector<T>

@}

Deduction Guides

Name

Description

MutableArrayRef<T>

@{ Deduction guide to construct a MutableArrayRef from a single element

MutableArrayRef<T>

Deduction guide to construct a MutableArrayRef from a SmallVector.

MutableArrayRef<T>

Deduction guide to construct a MutableArrayRef from a std::vector.

MutableArrayRef<T>

Deduction guide to construct a MutableArrayRef from a fixed‐size SmallVector.

MutableArrayRef<T>

Deduction guide to construct a MutableArrayRef from a std::array.

MutableArrayRef<T>

Deduction guide to construct a MutableArrayRef from a C array.

MutableArrayRef<T>

Deduction guide to construct a MutableArrayRef from a pointer and length.

Non-Member Functions

Name

Description

performOptimizedStructLayout

Compute a layout for a struct containing the given fields, making a best‐effort attempt to minimize the amount of space required.

lto::findThinLTOModule

Returns the BitcodeModule that is ThinLTO.

Return Value

Note

The return value should not be discarded.

Created with MrDocs