mrdocs::ArrayView

A non-owning, read-only view over a contiguous array of T.

Synopsis

Declared in <mrdocs/ADT/ArrayView.hpp>

template<class T>
class ArrayView;

Description

Similar to std::string_view but for arbitrary element type T.

Type Aliases

NameDescription
const_iterator Iterator over elements.
const_pointer Pointer to constant element.
const_reference Reference to constant element.
const_reverse_iterator Const reverse iterator over the view.
difference_type Signed iterator difference type.
iterator Iterator over elements.
pointer Pointer to constant element.
reference Reference to constant element.
reverse_iterator Reverse iterator over the view.
size_type Unsigned size type.
value_type Element type referenced by the view.

Member Functions

NameDescription
ArrayView [constructor]Constructors
at Access the element at the specified index with bounds checking.
back Return a reference to the last element.
begin Return an iterator to the first element.
cbegin Return a const iterator to the first element.
cend Return a const iterator one past the last element.
data Return a pointer to the underlying data.
drop_back Return a view with the last n elements removed.
drop_front Return a view with the first n elements removed.
empty Return true if the view contains no elements.
end Return an iterator one past the last element.
front Return a reference to the first element.
length Return the number of elements in the view.
operator[] Access the element at the specified index without bounds checking.
rbegin Return a reverse iterator to the last element.
remove_prefix Remove n elements from the front of the view.
remove_suffix Remove n elements from the back of the view.
rend Return a reverse iterator one before the first element.
size Return the number of elements in the view.
slice Return a subview starting at pos with up to count elements.
take_back Return a view containing the last n elements.
take_front Return a view containing the first n elements.

Static Data Members

NameDescription
npos Sentinel used by slicing helpers to indicate “until the end”.

Deduction Guides

NameDescription
ArrayView<T> Deduce ArrayView element type from C-style array.
ArrayView<T> Deduce ArrayView element type from pointer and count.

Friends

NameDescription
mrdocs::operator<=>Three-way comparison operator
mrdocs::operator==Equality operator

Non-Member Functions

NameDescription
make_array_viewCreate an ArrayView from a C-style array.
make_array_viewCreate an ArrayView from a pointer and count.