34 #include <Base/Common/SparseArray2D.hh>
44 void set(
const double d) { data=d; }
45 double get()
const {
return data; }
65 cout <<
"empty SparseArray2D: ";
67 cout <<
"empty() = "<<boolalpha<<array.
empty()<<endl;
70 cout <<
"empty Array2D of size 2x2 : ";
76 cout <<
"filled Array2D of size 2x2 : ";
82 cout <<
"partially filled Array2D of size 3x3 : ";
85 cout <<
"indices (4,0) are valid: "<<boolalpha<<array.
is_valid(4,0)<<endl;
86 cout <<
"indices (2,2) are valid: "<<boolalpha<<array.
is_valid(2,2)<<endl;
87 cout <<
"indices (2,1) are valid: "<<boolalpha<<array.
is_valid(2,1)<<endl;
91 for (it = array.
begin(); it!=array.
end(); it++, i++){
94 cout <<
"partially filled Array2D of size 3x3 : ";
100 array(r,c).set(r*3+c);
103 cout <<
"filled Array2D of size 3x3 : ";
106 cout <<
"array[1][1] = "<<array(1,1).get()<<endl;
const_iterator begin() const
for iterator access todo: derive from std::iterator class(es)
void resize(const unsigned nrows, const unsigned ncols)
preserves the content
bool is_valid(const unsigned row, const unsigned col) const
generic two dimensional psarsly populated rectangular array holding arbitrary data types ...
std::ostream & operator<<(std::ostream &os, const Array2D< T > &arg)
const_iterator end() const