#include "array.hh"
template class Array_Io<int>;
template class Array_Io<Array<int> >;
template class Array_Operator_Ee<int>;
const char* get_class_name(const Array<int>*)
{
return "Array<int>";
}
const char* get_class_name(const Array<Array<int> >*)
{
return "Array<Array<int>>";
}
int main()
{
Array<int> a;
a.add_element(new int(1));
a.add_element(new int(2));
a.add_element(new int(3));
a.add_element(new int(4));
PRINT(a);
cout << "*** Should be 0: ";
PRINT(find_element_equal(&a, 0, 1));
cout << '\n';
cout << "*** Should be 1: ";
PRINT(find_element_equal(&a, 0, 2));
cout << '\n';
cout << "*** Should be 2: ";
PRINT(find_element_equal(&a, 0, 3));
cout << '\n';
cout << "*** Should be 3: ";
PRINT(find_element_equal(&a, 0, 4));
cout << '\n';
cout << "*** Should be -1: ";
PRINT(find_element_equal(&a, 0, 5));
cout << '\n';
typedef Array<Array<int> > Array_Array_Int;
Array_Array_Int* a2 = new Array_Array_Int;
{
Array<int>* a = new Array<int>;
a->add_element(new int(1));
a->add_element(new int(2));
a->add_element(new int(3));
a2->add_element(a);
}
{
Array<int>* a = new Array<int>;
a->add_element(new int(4));
a->add_element(new int(5));
a->add_element(new int(6));
a2->add_element(a);
}
{
Array<int>* a = new Array<int>;
a->add_element(new int(7));
a->add_element(new int(8));
a->add_element(new int(9));
a2->add_element(a);
}
PRINT(*a2);
for (int y=0; y<a2->get_length(); y++) {
for (int x=0; x<a2->get_element_at(y)->get_length(); x++) {
delete a2->get_element_at(y)->get_element_at(x);
}
delete a2->get_element_at(y);
}
delete a2;
return EXIT_SUCCESS;
}
END_OF_MAIN();