|
Last change
on this file since a6b48f6 was e26a842, checked in by Peter A. Buhr <pabuhr@…>, 16 months ago |
|
update example programs
|
-
Property mode
set to
100644
|
|
File size:
400 bytes
|
| Line | |
|---|
| 1 | #include <cstdio>
|
|---|
| 2 |
|
|---|
| 3 | #if defined INTERPOSED_LIST_NS
|
|---|
| 4 | using namespace INTERPOSED_LIST_NS;
|
|---|
| 5 | #else
|
|---|
| 6 | #include <list>
|
|---|
| 7 | using namespace std;
|
|---|
| 8 | #endif
|
|---|
| 9 |
|
|---|
| 10 | int main() {
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | // C++
|
|---|
| 21 |
|
|---|
| 22 | struct req {
|
|---|
| 23 | int pri, rqr;
|
|---|
| 24 |
|
|---|
| 25 | };
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 | list<req *> reqs;
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 | req r1 = {1, 42}, r2 = {2, 42};
|
|---|
| 32 |
|
|---|
| 33 | reqs.push_front(&r2);
|
|---|
| 34 | reqs.push_front(&r1);
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 | for (auto const& cur : reqs)
|
|---|
| 50 | printf("{%d %d} ", cur->pri, cur->rqr);
|
|---|
| 51 | printf("\n");
|
|---|
| 52 |
|
|---|
| 53 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.