#include <SimpleArray.H>
using namespace xchen;
int main()
{
SimpleArray<int,2> i2(3,4);
i2 =
11,12,13,14,
15,16,17,18,
19,20,21,22;
cout << i2 << endl;
cout << "\nchange the first ele in the last row to -20\n";
i2.SetIndexStartAt(-2, 3);
for(int i=0; i<4; i++)
try
{
i2[0][i] = -20;
}
catch (ArrayError& e){ cout << e.ErrorMessage() << endl; }
cout << i2 << endl;
cout << "change last ele in the first row to -23.\n";
i2.SetIndexStartAt(-1, 0);
try
{
i2[Vector<int,2>(3,-1)] = -23;
}
catch (ArrayError&e){ cout << e.ErrorMessage() << endl; }
cout << i2 << endl;
cout << "change first ele in first row to -1.\n\n";
i2.SetIndexStartAt(-3, 0);
try
{
i2[-3][0] = -1;
}
catch (ArrayError&e){ cout << e.ErrorMessage() << endl; }
cout << i2 << endl;
SimpleArray<int,2>::iterator itr = i2.Iterate();
for(; !itr.PastEnd(); ++itr)
cout << *itr << endl;
}