1 auto sub = new ReplaySubject!int(1);
2 .put(sub, 1);
3
4 int[] buf;
5 auto d = sub.doSubscribe!(v => buf ~= v);
6 scope (exit)
7 d.dispose();
8
9 assert(buf.length == 1);
10 assert(buf[0] == 1);
1 auto sub = new ReplaySubject!int(1);
2 .put(sub, 1);
3 .put(sub, 2);
4
5 int[] buf;
6 auto d = sub.doSubscribe!(v => buf ~= v);
7 scope (exit)
8 d.dispose();
9
10 assert(buf == [2]);
1 auto sub = new ReplaySubject!int(2);
2 .put(sub, 1);
3 .put(sub, 2);
4 .put(sub, 3);
5
6 int[] buf;
7 auto d = sub.doSubscribe!(v => buf ~= v);
8 scope (exit)
9 d.dispose();
10
11 assert(buf == [2, 3]);