Template Class array

Inheritance Relationships

Base Type

Class Documentation

template <typename T, std::size_t N>
class array : public shad::AbstractDataStructure<array<T, N>>

Fixed size distributed array.

Section 21.3.7.1 of the C++ standard defines the ::array as a fixed-size sequence of objects. An ::array should be a contiguous container (as defined in section 21.2.1). According to that definition, contiguous containers requires contiguous iterators. The definition of contiguous iterators implies contiguous memory allocation for the sequence, and it cannot be guaranteed in many distributed settings. Therefore, ::array relaxes this requirement.

Template Parameters
  • T: The type of the elements in the distributed array.
  • N: The number of element in the distributed array.

Public Types

template<>
using ObjectID = typename AbstractDataStructure::ObjectID

The type for the global identifier.

template<>
using value_type = T

The type of the stored value.

template<>
using size_type = std::size_t

The type used to represent size.

template<>
using difference_type = std::ptrdiff_t

The type used to represent distances.

template<>
using reference = ArrayRef<value_type>

The type of references to the element in the array.

template<>
using const_reference = ArrayRef<const value_type>

The type for const references to element in the array.

template<>
using pointer = value_type *

The type for pointer to ::value_type.

template<>
using const_pointer = const value_type *

The type for pointer to ::const_value_type.

template<>
using iterator = array_iterator<value_type>

The type of iterators on the array.

template<>
using const_iterator = array_iterator<const value_type>

The type of const iterators on the array.

Public Functions

array<T, N> &operator=(const array<T, N> &O)

The copy assignment operator.

Return
A reference to the left-hand side.
Parameters
  • O: The right-hand side of the operator.

void fill(const value_type &v)

Fill the array with an input value.

Parameters
  • v: The input value used to fill the array.

void swap(array<T, N> &O)

Swap the content of two array.

Parameters
  • O: The array to swap the content with.

constexpr iterator begin()

The iterator to the beginning of the sequence.

Return
an ::iterator to the beginning of the sequence.

constexpr const_iterator begin() const

The iterator to the beginning of the sequence.

Return
a ::const_iterator to the beginning of the sequence.

constexpr iterator end()

The iterator to the end of the sequence.

Return
an ::iterator to the end of the sequence.

constexpr const_iterator end() const

The iterator to the end of the sequence.

Return
a ::const_iterator to the end of the sequence.

constexpr const_iterator cbegin() const

The iterator to the beginning of the sequence.

Return
a ::const_iterator to the beginning of the sequence.

constexpr const_iterator cend() const

The iterator to the end of the sequence.

Return
a ::const_iterator to the end of the sequence.

constexpr bool empty() const

Empty test.

Return
true if empty (N=0), and false otherwise.

constexpr size_type size() const

The size of the container.

Return
the size of the container (N).

constexpr size_type max_size() const

The maximum size of the container.

Return
the maximum size of the container (N).

constexpr reference operator[](size_type n)

Unchecked element access operator.

Return
a ::reference to the n-th element in the array.

constexpr const_reference operator[](size_type n) const

Unchecked element access operator.

Return
a ::const_reference to the n-th element in the array.

constexpr reference at(size_type n)

Checked element access operator.

Return
a ::reference to the n-th element in the array.

constexpr const_reference at(size_type n) const

Checked element access operator.

Return
a ::const_reference to the n-th element in the array.

constexpr reference front()

the first element in the array.

Return
a ::reference to the element in position 0.

constexpr const_reference front() const

the first element in the array.

Return
a ::const_reference to the element in position 0.

constexpr reference back()

the last element in the array.

Return
a ::reference to the element in position N - 1.

constexpr const_reference back() const

the last element in the array.

Return
a ::const_reference to the element in position N - 1.

ObjectID GetGlobalID() const

DataStructure identifier getter.

Returns the global object identifier associated to a DataStructure instance.

Warning
It must be implemented in the inheriting DataStructure.

Protected Functions

array(ObjectID oid)

Constructor.

Protected Static Functions

static constexpr std::size_t chunk_size()
static constexpr rt::Locality pivot_locality()

Friends

bool operator!=(const array<T, N> &LHS, const array<T, N> &RHS)
bool operator>=(const array<T, N> &LHS, const array<T, N> &RHS)
bool operator<=(const array<T, N> &LHS, const array<T, N> &RHS)
template <typename U>
template<>
class ArrayRef<const U> : public array::template BaseArrayRef<U>

Public Types

template<>
template<>
using value_type = const U
template<>
template<>
using pointer = typename array::pointer
template<>
template<>
using difference_type = typename array::difference_type
template<>
template<>
using ObjectID = typename array::ObjectID

Public Functions

template<>
ArrayRef(rt::Locality l, difference_type p, ObjectID oid, pointer chunk)
template<>
ArrayRef(const ArrayRef &O)
template<>
ArrayRef(ArrayRef &&O)
template<>
bool operator==(const ArrayRef &&v) const
template<>
ArrayRef &operator=(const ArrayRef &O)
template<>
ArrayRef &operator=(ArrayRef &&O)
template<>
operator value_type() const

Friends

std::ostream &operator<<(std::ostream &stream, const ArrayRef i)