diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-05-15 05:25:19 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-05-15 05:25:19 +0000 |
commit | dda94f3b53e02e117e6eb5758afa1410e1664c9f (patch) | |
tree | ec6df681df119c854bd0d1da2dffa45aba1f233b /src/tests/list.cpp | |
parent | 033c41ed57348abb3a418166b1fb39bfad3312de (diff) | |
download | libbu++-dda94f3b53e02e117e6eb5758afa1410e1664c9f.tar.gz libbu++-dda94f3b53e02e117e6eb5758afa1410e1664c9f.tar.bz2 libbu++-dda94f3b53e02e117e6eb5758afa1410e1664c9f.tar.xz libbu++-dda94f3b53e02e117e6eb5758afa1410e1664c9f.zip |
SPtr is now Bu::ified, and the List class now acts the way we think const lists
should act, you can't change anything in there. I'm still debating changing
the const_iterator to a constIterator, or something else that's more Bu::worthy.
Heh, the namespaces are funny...ok...I'm really tired.
Diffstat (limited to 'src/tests/list.cpp')
-rw-r--r-- | src/tests/list.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/tests/list.cpp b/src/tests/list.cpp index 34ab656..12807a5 100644 --- a/src/tests/list.cpp +++ b/src/tests/list.cpp | |||
@@ -1,4 +1,10 @@ | |||
1 | #include "bu/list.h" | 1 | #include "bu/list.h" |
2 | #include <list> | ||
3 | |||
4 | typedef struct Bob | ||
5 | { | ||
6 | int nID; | ||
7 | } Bob; | ||
2 | 8 | ||
3 | int main() | 9 | int main() |
4 | { | 10 | { |
@@ -16,7 +22,32 @@ int main() | |||
16 | { | 22 | { |
17 | printf("%d ", *i ); | 23 | printf("%d ", *i ); |
18 | } | 24 | } |
25 | printf("\n"); | ||
26 | for( Bu::List<int>::iterator i = l.begin(); i != l.end(); i++ ) | ||
27 | { | ||
28 | l.erase( i ); | ||
29 | if( i != l.end() ) | ||
30 | printf("%d ", *i ); | ||
31 | } | ||
32 | |||
33 | printf("\n\n"); | ||
19 | 34 | ||
35 | Bu::List<Bob> lb; | ||
36 | for( int j = 0; j < 10; j++ ) | ||
37 | { | ||
38 | Bob b; | ||
39 | b.nID = j; | ||
40 | lb.append( b ); | ||
41 | } | ||
42 | |||
43 | const Bu::List<Bob> rb = lb; | ||
44 | |||
45 | for( Bu::List<Bob>::const_iterator i = rb.begin(); i != rb.end(); i++ ) | ||
46 | { | ||
47 | //i->nID += 2; | ||
48 | //(*i).nID = 4; | ||
49 | printf("%d ", i->nID ); | ||
50 | } | ||
20 | printf("\n\n"); | 51 | printf("\n\n"); |
21 | } | 52 | } |
22 | 53 | ||