![]() |
Hex
1.0
Hydrogen-electron collision solver
|
A comfortable data array class. More...
#include <arrays.h>
Public Types | |
typedef T | DataType |
typedef T * | iterator |
typedef T const * | const_iterator |
![]() | |
typedef T | DataType |
typedef T * | iterator |
typedef T const * | const_iterator |
Public Member Functions | |
Array () | |
Alloc::alloc (n)) | |
Array (size_t n, T const *const x) | |
Array (Array< T > const &a) | |
Array (const ArrayView< T > a) | |
Array (Array< T > &&a) | |
Array (std::vector< T > const &a) | |
Array (std::initializer_list< T > a) | |
template<typename ForwardIterator > | |
Array (ForwardIterator i, ForwardIterator j) | |
~Array () | |
size_t | size () const |
Return number of elements. More... | |
virtual size_t | resize (size_t n) |
Resize array. More... | |
T & | operator[] (size_t i) |
Element-wise access (non-const). More... | |
T const & | operator[] (size_t i) const |
Element-wise access (const). More... | |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
T & | front (int i=0) |
T const & | front (int i=0) const |
T & | back (int i=0) |
T const & | back (int i=0) const |
virtual void | push_back (T const &a) |
Append an element to the end. More... | |
virtual T | pop_back () |
Remove the last element from the array. More... | |
template<class InputIterator > | |
void | append (InputIterator first, InputIterator last) |
Append more items. More... | |
void | insert (iterator it, T x) |
Insert item. More... | |
bool | empty () const |
Check that size equals to zero. More... | |
Array< T > & | operator= (Array< T > const &b) |
Array< T > & | operator= (Array< T > &&b) |
virtual T * | data () |
Data pointer. More... | |
virtual T const * | data () const |
![]() | |
ArrayView () | |
ArrayView (size_t n, T *ptr) | |
ArrayView (ArrayView< T > const &a, size_t i=0, size_t n=0) | |
ArrayView (Array< T > const &a, size_t i=0, size_t n=0) | |
ArrayView (NumberArray< T > const &a, size_t i=0, size_t n=0) | |
ArrayView (const_iterator i, const_iterator j) | |
ArrayView (ArrayView< T > &&r) | |
virtual | ~ArrayView () |
ArrayView< T > & | operator= (const ArrayView< T > v) |
Assignment operator. More... | |
T & | operator[] (size_t i) |
Element-wise access (non-const). More... | |
T const & | operator[] (size_t i) const |
Element-wise access (const). More... | |
size_t | size () const |
Length of the array (number of elements). More... | |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
T & | front (int i=0) |
T const & | front (int i=0) const |
T & | back (int i=0) |
T const & | back (int i=0) const |
void | fill (T x) |
Fill the array with a value. More... | |
bool | empty () const |
Check whether the size is equal to zero. More... | |
template<class = typename std::enable_if<is_scalar<T>::value>> | |
double | norm () const |
Two-norm (defined only for scalar data type). More... | |
Data Fields | |
__pad0__: ArrayView<T>(n | |
Additional Inherited Members | |
![]() | |
size_t | N_ |
Number of elements in the array. More... | |
T * | array_ |
Pointer to the array. More... | |
Class Array is intended as a Hex's replacement for std::vector<T>. Properties:
typedef T const* Array< T, Alloc >::const_iterator |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
The function appends a range of items to the end of the array. A reallocation takes place. The range is specified using input iterators.
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
Reimplemented from ArrayView< T >.
Reimplemented in NumberArray< T, Alloc >, and NumberArray< Tout >.
|
inlinevirtual |
Reimplemented from ArrayView< T >.
Reimplemented in NumberArray< T, Alloc >, and NumberArray< Tout >.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Function "insert" inserts new item "x" to the array at position pointed to by the iterator "it". Reallocation always taked place. If the iterator points to the end of the original array, the effect is the same as push_back. Otherwise, the items behind the iterator are shifted to make place for the new item.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
The last element of the array will be ignored, which is achieved by decrementing array length. The memory will not be deallocated to save processor time. For this reason, if an array is "erased" by subsequent calls to pop_back, it will still occupy the same memory as before. The deallocation will take place only on resize.
Reimplemented in NumberArray< T, Alloc >, and NumberArray< Tout >.
|
inlinevirtual |
The function will append the element "a" to the end of the array. This will require allocation of a longer array and copy of the original elements to the new array (using the rvalue reference). The function is declared as virtual so that it can be safely overridden in derived classes.
Reimplemented in NumberArray< T, Alloc >, and NumberArray< Tout >.
|
inlinevirtual |
The method will change the length of the array, most probably by reallocating the storage. The possible new elements will be initialized to T(0). The function is virtual, so that is can be safely overridden in the derived classes.
Reimplemented in NumberArray< T, Alloc >, and NumberArray< Tout >.
|
inline |
Array< T, Alloc >::__pad0__ |