|
| ~arraynd_base ()=default |
| Destructor. More...
|
|
std::array< int64, ndims > | dims () const |
| Returns the lengths of each dimension. More...
|
|
std::array< int64, ndims > | strides () const |
| Returns the number of element-size steps in memory between successive elements for each dimension. More...
|
|
bool | empty () const |
| Returns true if there is at least one element. More...
|
|
int64 | size () const |
| Returns the total number of elements. More...
|
|
int64 | offset () const |
| Returns the number of element-size steps in memory before the first element. More...
|
|
const T * | data () const |
| Returns a pointer to the element data (const). More...
|
|
T * | data () |
| Returns a pointer to the element data. More...
|
|
bool | is_contiguous () const |
| Returns true if a row-major traversal of the multidimensional array accesses each element of data in sequence. More...
|
|
bool | is_view () const |
| Returns true if this multidimensional array is a view of another, meaning that data is shared. More...
|
|
bool | is_readonly () const |
| Returns true if the data is readonly, in which case attempts to modify it raise a std::logic_error. More...
|
|
const T & | operator() (const std::array< int64, ndims > &indices) const |
| Returns a reference to an element (const). More...
|
|
T & | operator() (const std::array< int64, ndims > &indices) |
| Returns a reference to an element. More...
|
|
const T & | operator() (const arraynd_base< int64, 1 > &indices) const |
| Returns a reference to an element (const). More...
|
|
T & | operator() (const arraynd_base< int64, 1 > &indices) |
| Returns a reference to an element. More...
|
|
template<typename... Indices> |
const T & | operator() (Indices... indices) const |
| Returns a reference to an element (const). More...
|
|
template<typename... Indices> |
T & | operator() (Indices... indices) |
| Returns a reference to an element. More...
|
|
void | fill (const T &value) |
| Replaces every element with value . More...
|
|
void | assign (const arraynd_base< T, ndims > &rhs) |
| Replaces every element with the corresponding value in rhs . More...
|
|
void | assign_from_function (std::function< T(const std::array< int64, ndims > &indices)> func) |
| Replaces every element with the result of func evaluated at the cooresponding indices . More...
|
|
bool | traverse (std::function< bool(const std::array< int64, ndims > &indices, const T &value)> func) const |
| Traverses the multidimensional array in row-major order, calling func at every element. More...
|
|
|
| arraynd_base () |
|
| arraynd_base (const std::array< int64, ndims > &dims, const T &value) |
|
| arraynd_base (const std::array< int64, ndims > &dims, const std::vector< T > &data) |
|
| arraynd_base (const std::array< int64, ndims > &dims, std::function< T(const std::array< int64, ndims > &indices)> func) |
|
| arraynd_base (const arraynd_base< T, ndims+1 > &rhs, int64 index, bool is_readonly) |
|
| arraynd_base (const arraynd_base< T, ndims > &rhs, range r, bool is_readonly) |
|
| arraynd_base (const arraynd_base< T, ndims > &rhs, bool is_view, bool is_readonly) |
|
| arraynd_base (const arraynd_base< T, ndims > &rhs) |
|
arraynd_base< T, ndims > & | operator= (const arraynd_base< T, ndims > &rhs) |
|
| arraynd_base (arraynd_base< T, ndims > &&)=default |
|
arraynd_base< T, ndims > & | operator= (arraynd_base< T, ndims > &&)=default |
|
template<typename T, int64 ndims>
class sydevs::arraynd_base< T, ndims >
A base class template for a multidimensional array with elements of type T
arranged in a lattice of ndim
dimensions.
arraynd_base
contains all member variables, all member functions that behave the same for ndims == 1
and ndims > 1
, and all member functions that do not return a multidimensional array.
template<typename T , int64 ndims>
bool sydevs::arraynd_base< T, ndims >::traverse |
( |
std::function< bool(const std::array< int64, ndims > &indices, const T &value)> |
func | ) |
const |
Traverses the multidimensional array in row-major order, calling func
at every element.
For each element traversed in row-major order, func
is called with the indices
of the element and the element's value
. If func
returns true
, the traversal continues. If func
returns false
, the traversal is terminated.
- Parameters
-
func | The function to be called at every element. |
- Returns
true
if the entire multidimensional array is traversed and func
returns true
at every element; false
otherwise.