| Rev | Line | |
|---|
| [2] | 1 | #include "stream.h" |
|---|
| 2 | #include "test_common.h" |
|---|
| 3 | |
|---|
| 4 | template<typename T> |
|---|
| 5 | stream<int> helper(int x, T &&s) |
|---|
| 6 | { |
|---|
| 7 | if(x==0) { |
|---|
| 8 | return stream<int>(s); |
|---|
| 9 | } else { |
|---|
| 10 | --x; |
|---|
| 11 | return helper(x, x<<=std::forward<T>(s)); |
|---|
| 12 | } |
|---|
| 13 | } |
|---|
| 14 | |
|---|
| 15 | int main() |
|---|
| 16 | { |
|---|
| 17 | stream<int> s =helper(1, s); |
|---|
| 18 | stream<int> s1=helper(2, s1); |
|---|
| 19 | stream<int> s2=helper(3, 9<<=s2); |
|---|
| 20 | stream<int> s3=helper(0, 9<<=s3); |
|---|
| 21 | stream<int> s4=helper(1, 9<<=s4); |
|---|
| 22 | compare(s, {0}); |
|---|
| 23 | compare(s1, {0,1}); |
|---|
| 24 | compare(s2, {0,1,2,9}); |
|---|
| 25 | compare(s3, {9}); |
|---|
| 26 | compare(s4, {0,9}); |
|---|
| 27 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.