Example for usage of class Array2D
- Author
- MIP
#include <Base/Common/Array2D.hh>
#include <iostream>
using namespace BIAS;
using namespace std;
class foo
{
public:
void set(const double d) { data=d; }
double get() const { return data; }
protected:
double data;
};
{
cout << nr << " x "<< nc <<" :\n";
for (unsigned r=0; r<nr; r++){
for (unsigned c=0; c<nc; c++){
cout << a(r,c).get() << "\t";
}
cout << "\n";
}
}
int main()
{
cout << "empty Array2D: ";
print(array);
cout <<
"empty() = "<<boolalpha<<array.
empty()<<endl;
cout << "empty Array2D of size 2x2 : ";
print(array);
foo f;
f.set(2.0);
cout << "filled Array2D of size 2x2 : ";
print(array);
cout << "partially filled Array2D of size 3x3 : ";
print(array);
int i=0;
for (it = array.
begin(); it!=array.
end(); it++, i++){
it->set((double)i);
}
cout << "filled Array2D of size 3x3 : ";
print(array);
cout << "array[1][1] = "<<array[1][1].get()<<endl;
return 0;
}