Dynamic Array Template and Iterator Demo
[dynamic_array_template.git] / DynamicArrayDemo.cpp
1 /*
2  * Demonstration of a dynamically sizing Array Template including STL Iterator
3  * Copyright (c) 2014 TJ <hacker@iam.tj>
4  * 
5  *    This program is free software: you can redistribute it and/or modify
6  *    it under the terms of the GNU General Public License as published by
7  *    the Free Software Foundation, either version 3 of the License.
8  *
9  *    This program is distributed in the hope that it will be useful,
10  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *    GNU General Public License for more details.
13  *
14  *   You should have received a copy of the GNU General Public License
15  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  *
17  */
18
19 #include <iostream>
20 #include "DynamicArrayTemplateImpl.hpp"
21
22 using namespace std;
23 using namespace tj;
24
25 int
26 main(int argc, char **argv, char **env)
27 {
28   cout << "Dynamic Array with Iterator Demonstrator" << endl
29        << "Copyright 2014 TJ <hacker@iam.tj>" << endl
30        << "Licensed on terms of the GNU General Public License version 3.0" << endl;
31   DynamicArrayTemplateImpl< DynamicArrayTemplateImpl<int> > array_of_arrays;
32   DynamicArrayTemplateImpl<int> array_of_ints;
33   DynamicArrayTemplateImpl<int>::_const_iterator i = array_of_ints.begin();
34   DynamicArrayTemplateImpl<DynamicArrayTemplateImpl<int>>::_const_iterator j = array_of_arrays.begin();
35
36   unsigned menu_choice;
37
38   do
39   {
40     cout << endl << "Menu" << endl
41          << "1. Create array" << endl
42          << "2. Add element" << endl
43          << "3. Remove element" << endl
44          << "4. List array elements using Iterator" << endl
45          << "5. List array elements using subscript operator[]" << endl
46          << "7. List array elements using pointers (element_at())" << endl
47          << "8. Delete array" << endl
48          << "0. Exit" << endl;
49
50     cin >> menu_choice;
51
52     switch (menu_choice)
53     {
54       case 0: // exit
55         break;
56       case 1: // Create array
57         break;
58       case 2: // Add element
59         break;
60       case 3: // Remove element
61         break;
62       case 4: // List using Iterator
63         break;
64       case 5: // List using subscript operator[]
65         break;
66       case 6: // List using pointer element_at()
67         break;
68     }
69   } while (menu_choice > 0);
70
71   cout << endl << "Finished." << endl;
72   return 0;
73 }