semf
|
This is an interface to std::array
with the benefit of knowing its size without using a template parameter so it can be used easier in object oriented code.
More...
#include <array.h>
Public Types | |
using | value_type = T |
using | size_type = std::size_t |
using | difference_type = std::ptrdiff_t |
using | reference = value_type & |
using | const_reference = const value_type & |
using | iterator = T * |
using | const_iterator = const T * |
using | reverse_iterator = std::reverse_iterator< iterator > |
using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
Public Member Functions | |
virtual | ~Array ()=default |
virtual reference | at (size_type pos)=0 |
Returns a reference to the element at specified location pos , with bounds checking. More... | |
virtual const_reference | at (size_type pos) const =0 |
Returns a reference to the element at specified location pos , with bounds checking. More... | |
virtual reference | operator[] (size_type pos)=0 |
Returns a reference to the element at specified location pos . No bounds checking is performed. More... | |
virtual const_reference | operator[] (size_type pos) const =0 |
Returns a reference to the element at specified location pos . No bounds checking is performed. More... | |
virtual reference | front ()=0 |
Returns a reference to the first element in the container. Calling front on an empty container is undefined. More... | |
virtual const_reference | front () const =0 |
Returns a reference to the first element in the container. Calling front on an empty container is undefined. More... | |
virtual reference | back ()=0 |
Returns a reference to the last element in the container. Calling back on an empty container causes undefined behavior. More... | |
virtual const_reference | back () const =0 |
Returns a reference to the last element in the container. Calling back on an empty container causes undefined behavior. More... | |
virtual iterator | data ()=0 |
Returns pointer to the underlying array serving as element storage. The pointer is such that range [data(); data() + size()) is always a valid range, even if the container is empty ( data() is not dereferenceable in that case). More... | |
virtual const T * | data () const =0 |
Returns pointer to the underlying array serving as element storage. The pointer is such that range [data(); data() + size()) is always a valid range, even if the container is empty ( data() is not dereferenceable in that case). More... | |
virtual iterator | begin ()=0 |
Returns an iterator to the first element of the array. If the array is empty, the returned iterator will be equal to end() . More... | |
virtual const_iterator | begin () const =0 |
Returns an iterator to the first element of the array. If the array is empty, the returned iterator will be equal to end() . More... | |
virtual const_iterator | cbegin () const =0 |
Returns an iterator to the first element of the array. If the array is empty, the returned iterator will be equal to end() . More... | |
virtual iterator | end ()=0 |
Returns an iterator to the element following the last element of the array. This element acts as a placeholder; attempting to access it results in undefined behavior. More... | |
virtual const_iterator | end () const =0 |
Returns an iterator to the element following the last element of the array. This element acts as a placeholder; attempting to access it results in undefined behavior. More... | |
virtual const_iterator | cend () const =0 |
Returns an iterator to the element following the last element of the array. This element acts as a placeholder; attempting to access it results in undefined behavior. More... | |
virtual reverse_iterator | rbegin ()=0 |
Returns a reverse iterator to the first element of the reversed array. It corresponds to the last element of the non-reversed array. If the array is empty, the returned iterator is equal to rend() . More... | |
virtual const_reverse_iterator | rbegin () const =0 |
Returns a reverse iterator to the first element of the reversed array. It corresponds to the last element of the non-reversed array. If the array is empty, the returned iterator is equal to rend() . More... | |
virtual const_reverse_iterator | crbegin () const =0 |
Returns a reverse iterator to the first element of the reversed array. It corresponds to the last element of the non-reversed array. If the array is empty, the returned iterator is equal to rend() . More... | |
virtual reverse_iterator | rend ()=0 |
Returns a reverse iterator to the element following the last element of the reversed array. It corresponds to the element preceding the first element of the non-reversed array. This element acts as a placeholder, attempting to access it results in undefined behavior. More... | |
virtual const_reverse_iterator | rend () const =0 |
Returns a reverse iterator to the element following the last element of the reversed array. It corresponds to the element preceding the first element of the non-reversed array. This element acts as a placeholder, attempting to access it results in undefined behavior. More... | |
virtual const_reverse_iterator | crend () const =0 |
Returns a reverse iterator to the element following the last element of the reversed array. It corresponds to the element preceding the first element of the non-reversed array. This element acts as a placeholder, attempting to access it results in undefined behavior. More... | |
virtual bool | empty () const =0 |
Checks if the container has no elements, i.e. whether begin() == end() . More... | |
virtual size_type | size () const =0 |
Returns the number of elements in the container, i.e. std::distance(begin(), end()) . More... | |
virtual size_type | max_size () const =0 |
Returns the maximum number of elements the container is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest container. More... | |
virtual void | fill (const T &value)=0 |
Assigns the given value value to all elements in the container. More... | |
virtual bool | swap (Array< T > &other)=0 |
Exchanges the contents of the container with those of other. Does not cause iterators and references to associate with the other container. In order to succeed both array must be equally sized. More... | |
This is an interface to std::array
with the benefit of knowing its size without using a template parameter so it can be used easier in object oriented code.
T | Element type of the array. |
using semf::Array< T >::const_iterator = const T* |
using semf::Array< T >::const_reference = const value_type& |
using semf::Array< T >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
using semf::Array< T >::difference_type = std::ptrdiff_t |
using semf::Array< T >::iterator = T* |
using semf::Array< T >::reference = value_type& |
using semf::Array< T >::reverse_iterator = std::reverse_iterator<iterator> |
using semf::Array< T >::size_type = std::size_t |
using semf::Array< T >::value_type = T |
|
virtualdefault |
|
pure virtual |
Returns a reference to the element at specified location pos
, with bounds checking.
pos | Position of the element to return. |
std::out_of_range | If !(pos < size()) . |
|
pure virtual |
Returns a reference to the element at specified location pos
, with bounds checking.
pos | Position of the element to return. |
std::out_of_range | If !(pos < size()) . |
|
pure virtual |
Returns a reference to the last element in the container. Calling back
on an empty container causes undefined behavior.
|
pure virtual |
Returns a reference to the last element in the container. Calling back
on an empty container causes undefined behavior.
|
pure virtual |
Returns an iterator to the first element of the array. If the array is empty, the returned iterator will be equal to end()
.
|
pure virtual |
Returns an iterator to the first element of the array. If the array is empty, the returned iterator will be equal to end()
.
|
pure virtual |
Returns an iterator to the first element of the array. If the array is empty, the returned iterator will be equal to end()
.
|
pure virtual |
Returns an iterator to the element following the last element of the array. This element acts as a placeholder; attempting to access it results in undefined behavior.
|
pure virtual |
Returns a reverse iterator to the first element of the reversed array. It corresponds to the last element of the non-reversed array. If the array is empty, the returned iterator is equal to rend()
.
|
pure virtual |
Returns a reverse iterator to the element following the last element of the reversed array. It corresponds to the element preceding the first element of the non-reversed array. This element acts as a placeholder, attempting to access it results in undefined behavior.
|
pure virtual |
Returns pointer to the underlying array serving as element storage. The pointer is such that range [data(); data() + size())
is always a valid range, even if the container is empty ( data()
is not dereferenceable in that case).
|
pure virtual |
Returns pointer to the underlying array serving as element storage. The pointer is such that range [data(); data() + size())
is always a valid range, even if the container is empty ( data()
is not dereferenceable in that case).
|
pure virtual |
|
pure virtual |
Returns an iterator to the element following the last element of the array. This element acts as a placeholder; attempting to access it results in undefined behavior.
|
pure virtual |
Returns an iterator to the element following the last element of the array. This element acts as a placeholder; attempting to access it results in undefined behavior.
|
pure virtual |
Assigns the given value value to all elements in the container.
value | The value to assign to the elements. |
|
pure virtual |
Returns a reference to the first element in the container. Calling front
on an empty container is undefined.
|
pure virtual |
Returns a reference to the first element in the container. Calling front
on an empty container is undefined.
|
pure virtual |
|
pure virtual |
Returns a reference to the element at specified location pos
. No bounds checking is performed.
pos | Position of the element to return. |
|
pure virtual |
Returns a reference to the element at specified location pos
. No bounds checking is performed.
pos | Position of the element to return. |
|
pure virtual |
Returns a reverse iterator to the first element of the reversed array. It corresponds to the last element of the non-reversed array. If the array is empty, the returned iterator is equal to rend()
.
|
pure virtual |
Returns a reverse iterator to the first element of the reversed array. It corresponds to the last element of the non-reversed array. If the array is empty, the returned iterator is equal to rend()
.
|
pure virtual |
Returns a reverse iterator to the element following the last element of the reversed array. It corresponds to the element preceding the first element of the non-reversed array. This element acts as a placeholder, attempting to access it results in undefined behavior.
|
pure virtual |
Returns a reverse iterator to the element following the last element of the reversed array. It corresponds to the element preceding the first element of the non-reversed array. This element acts as a placeholder, attempting to access it results in undefined behavior.
|
pure virtual |
|
pure virtual |
Exchanges the contents of the container with those of other. Does not cause iterators and references to associate with the other container. In order to succeed both array must be equally sized.
other | Container to exchange the contents with. |
true
if successful, otherwise false
.