11#ifndef NDARRAY_ExpressionBase_h_INCLUDED
12#define NDARRAY_ExpressionBase_h_INCLUDED
39template <
typename Derived>
64 Reference
back()
const {
return this->
operator[](this->
template getSize<0>()-1); }
73 template <
int P> Size
getSize()
const {
return getSelf().template getSize<P>(); }
83 typedef Value value_type;
89 typedef Offset difference_type;
90 typedef Size size_type;
93 size_type
size()
const {
return this->
template getSize<0>(); }
96 bool empty()
const {
return this->
template getSize<0>() == 0; }
101 Self & getSelf() {
return *
static_cast<Self *
>(
this); }
102 Self const & getSelf()
const {
return *
static_cast<Self const *
>(
this); }
CRTP base class for all multidimensional expressions.
Definition ExpressionBase.h:40
ExpressionTraits< Derived >::Value Value
Nested expression or element value type.
Definition ExpressionBase.h:51
size_type size() const
Return the size of the first dimension.
Definition ExpressionBase.h:93
Reference front() const
Return the first nested expression or element.
Definition ExpressionBase.h:61
Reference back() const
Return the last nested expression or element.
Definition ExpressionBase.h:64
Vector< Size, ND::value > Index
Vector type for N-dimensional indices.
Definition ExpressionBase.h:53
Reference operator[](Size n) const
Return a single nested expression or element.
Definition ExpressionBase.h:58
ExpressionTraits< Derived >::ND ND
Number of dimensions (boost::mpl::int_).
Definition ExpressionBase.h:45
ExpressionTraits< Derived >::Reference Reference
Nested expression or element reference.
Definition ExpressionBase.h:49
Index getShape() const
Return a Vector of the sizes of all dimensions.
Definition ExpressionBase.h:76
Size getNumElements() const
Return the total number of elements in the expression.
Definition ExpressionBase.h:79
ExpressionTraits< Derived >::Element Element
Data type of expression elements.
Definition ExpressionBase.h:43
Iterator end() const
Return an Iterator to one past the end of the expression.
Definition ExpressionBase.h:70
Iterator begin() const
Return an Iterator to the beginning of the expression.
Definition ExpressionBase.h:67
Derived Self
CRTP derived type.
Definition ExpressionBase.h:55
bool empty() const
Return true if the first dimension has no elements.
Definition ExpressionBase.h:96
ExpressionTraits< Derived >::Iterator Iterator
Nested expression or element iterator.
Definition ExpressionBase.h:47
Size getSize() const
Return the size of a specific dimension.
Definition ExpressionBase.h:73
Traits for expressions.
Definition ExpressionTraits.h:30
A fixed-size 1D array class.
Definition Vector.h:82