fixed iterators and iterator usage
This commit is contained in:
parent
907377e32f
commit
6037ce30a7
1451
src/list.hh
1451
src/list.hh
File diff suppressed because it is too large
Load Diff
18
src/test.cc
18
src/test.cc
@ -1,25 +1,29 @@
|
|||||||
#include "list.hh"
|
#include "list.hh"
|
||||||
#include "vector.hh"
|
#include "vector.hh"
|
||||||
#include <cstdio>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace phundrak;
|
using namespace phundrak;
|
||||||
|
using std::cout;
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
|
||||||
printf("Hello 1!\n");
|
|
||||||
list<char> test {'C', 'a', 'r', 't', 'i', 'e', 'r'};
|
list<char> test {'C', 'a', 'r', 't', 'i', 'e', 'r'};
|
||||||
printf("Hello !\n");
|
|
||||||
|
|
||||||
for(auto c : test) {
|
for(auto c : test)
|
||||||
printf("%c\n", c);
|
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};
|
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");
|
printf("Elements before unique():\n");
|
||||||
for(const auto& elem : test_unique)
|
for(const auto& elem : test_unique)
|
||||||
printf("%2d,", elem);
|
cout << elem << " ";
|
||||||
|
|
||||||
|
cout << "\n";
|
||||||
test_unique.unique();
|
test_unique.unique();
|
||||||
|
for(const auto& elem : test_unique)
|
||||||
|
cout << elem << " ";
|
||||||
|
cout << "\n";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user