From d05de564091c24677a94e16963dad20be4b00ca0 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 11 Jul 2007 21:48:41 +0000 Subject: I guess I fixed some list stuff... --- src/tests/list.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/tests') diff --git a/src/tests/list.cpp b/src/tests/list.cpp index 12807a5..edbe288 100644 --- a/src/tests/list.cpp +++ b/src/tests/list.cpp @@ -18,6 +18,21 @@ int main() l.prepend( -j ); } + { + Bu::List::iterator i = l.begin(); + Bu::List::iterator j = i; + int a, b; + a = *j; + printf("end: %s\n", (j != l.end())?"no":"yes"); + j--; + printf("end: %s\n", (j != l.end())?"no":"yes"); + j++; + printf("end: %s\n", (j != l.end())?"no":"yes"); + i = j; + b = *i; + printf("%d -> %d\n", a, b ); + } + for( Bu::List::iterator i = l.begin(); i != l.end(); i++ ) { printf("%d ", *i ); @@ -25,9 +40,11 @@ int main() printf("\n"); for( Bu::List::iterator i = l.begin(); i != l.end(); i++ ) { + Bu::List::iterator j = i; j--; l.erase( i ); + i = j; if( i != l.end() ) - printf("%d ", *i ); + printf("!%d ", *i ); } printf("\n\n"); -- cgit v1.2.3