fixed iterators and iterator usage

This commit is contained in:
Phuntsok Drak-pa 2017-10-20 19:25:56 +02:00
parent 907377e32f
commit 6037ce30a7
2 changed files with 753 additions and 716 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,29 @@
#include "list.hh"
#include "vector.hh"
#include <cstdio>
#include <iostream>
using namespace phundrak;
using std::cout;
int main(void) {
printf("Hello 1!\n");
list<char> test {'C', 'a', 'r', 't', 'i', 'e', 'r'};
printf("Hello !\n");
for(auto c : test) {
printf("%c\n", c);
}
for(auto c : test)
cout << c << " ";
cout << "\n";
list<int> test_unique {1,1,1,1,1,2,2,2,3,3,3,4,4,1,1,5,1,2,1,1,3,3,3};
printf("Elements before unique():\n");
for(const auto& elem : test_unique)
printf("%2d,", elem);
cout << elem << " ";
cout << "\n";
test_unique.unique();
for(const auto& elem : test_unique)
cout << elem << " ";
cout << "\n";
return 0;
}