8 namespace frechet {
namespace data {
59 const T&
at (
int i,
int j)
const {
return d[
offset(i,j)]; }
215 iterator
begin() {
return iterator(
this,0); }
217 iterator
end() {
return iterator(
this,
n*
m); }
227 Q_ASSERT(i>=0 && i < n && j>=0 && j <
m);
237 Q_ASSERT(off>=0 && off<
n*
m);
247 static void copy(T* dst, T* src,
int count);
T & operator[](int offset)
array accessor
int _offset
current offset
bool operator==(const iterator &that) const
equality comparator
iterator & left()
move index one column to the left (decrement)
static void copy(T *dst, T *src, int count)
copy a number of entries
bool operator!=(const iterator &that) const
non-equality comparator
global definitions for all algorithms.
T & at(int offset)
array accessor
Array2D & operator=(const Array2D &that)
assignment operator
iterator & operator=(const iterator &that)
iterator & operator++()
pre-increment
iterator & to(int off)
move iterator to a given linear offset
Array2D * parent
reference to paran
iterator & up()
move index one row up (increment)
~Array2D()
destructor; releases data
Array2D(int an=0, int am=0)
default constructor
A simple two-dimensional array of fixed size.
const T & at(int offset) const
array accessor
const int m
number of rows
iterator(Array2D *aparent, int start)
constructor with parent and start index
size_t offset(int i, int j) const
compute linear offset
iterator & operator--()
pre-decrement
const T & at(int i, int j) const
array accessor
const int n
number of columns
iterator & down()
move index one row down (decrement)
iterator & right()
move index one column to the right (increment)
bool valid(int off) const
T & at(int i, int j)
array accessor
void indices(int off, int *i, int *j) const
compute columnd and row from linear index
iterator & to(int i, int j)
move iterator to a given index
iterator()
default constructor