1 //////////////////////////////////////////////////////////////////////////////
2 // Testing the standard template library style iterator with lists.
3 //////////////////////////////////////////////////////////////////////////////
5 #include <AD/stl/algorithm.h>
6 #include <AD/stl/streamiter.h>
9 datatype LIST<T> = #[] | #[ T ... LIST<T> ];
11 instantiate datatype LIST<int>, LIST<char *>;
16 #[ "lemons", "apple", "oranges", "pears", "pineapple", "kiwi" ];
18 ostream_iterator<char *> p(cout, " ");
20 copy(list_iterator<LIST<char *>, char *>(fruits),
21 list_iterator<LIST<char *>, char *>(list_nil(fruits)),
25 LIST<int> primes = #[2, 3, 5, 7, 11, 13, 17, 19, 23];
27 ostream_iterator<int> q(cout, " ");
28 copy(list_iterator<LIST<int>, int>(primes),
29 list_iterator<LIST<int>, int>(list_nil(primes)),