mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-18 01:59:03 +08:00
6599da043e
From-SVN: r14877
45 lines
1.1 KiB
Plaintext
45 lines
1.1 KiB
Plaintext
|
|
list<int> a = sequence(1, 20);
|
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
|
|
|
list<int> b = randseq(20);
|
|
28 27 5 17 44 6 9 40 15 26 49 35 15 48 13 27 25 25 9 6
|
|
|
|
list<int> c = a and b;
|
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 28 27 5 17 44 6 9 40 15 26 49 35 15 48 13 27 25 25 9 6
|
|
|
|
list<int> d = map(inc, a);
|
|
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
|
|
|
list<int> e = reverse(a);
|
|
20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
|
|
|
|
list<int> f = select(is_odd, a);
|
|
1 3 5 7 9 11 13 15 17 19
|
|
|
|
int red = a.reduce(plus, 0);
|
|
210
|
|
int second = a[2];
|
|
3
|
|
list<int> g = combine(plus, a, b);
|
|
29 29 8 21 49 12 16 48 24 36 60 47 28 62 28 43 42 43 28 26
|
|
|
|
g.del(is_odd);
|
|
8 12 16 48 24 36 60 28 62 28 42 28 26
|
|
|
|
b.sort(int_compare);
|
|
5 6 6 9 9 13 15 15 17 25 25 26 27 27 28 35 40 44 48 49
|
|
|
|
list<int> h = merge(a, b, int_compare);
|
|
1 2 3 4 5 5 6 6 6 7 8 9 9 9 10 11 12 13 13 14 15 15 15 16 17 17 18 19 20 25 25 26 27 27 28 35 40 44 48 49
|
|
|
|
h via iterator:
|
|
1, 2, 3, 4, 5, 5, 6, 6, 6, 7, 8, 9, 9, 9, 10, 11, 12, 13, 13, 14, 15, 15, 15, 16, 17, 17, 18, 19, 20, 25, 25, 26, 27, 27, 28, 35, 40, 44, 48, 49,
|
|
1
|
|
4
|
|
9
|
|
16
|
|
36
|
|
|
|
done
|