source:
doc/theses/mike_brooks_MMath/programs/lst-issues-wrapped-byref.run.cpp@
33e9b87
      
      | Last change on this file since 33e9b87 was 5717495, checked in by , 3 years ago | |
|---|---|
| 
 | |
| File size: 412 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 | |
| 29 | list<req*> reqs; | 
| 30 | |
| 31 | |
| 32 | req | 
| 33 | r1 = {1, 42}, | 
| 34 | r2 = {2, 42}; | 
| 35 | |
| 36 | reqs.push_front( | 
| 37 | &r2); | 
| 38 | reqs.push_front( | 
| 39 | &r1); | 
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | for (auto const& cur : reqs) | 
| 55 | printf("{%d %d} ", cur->pri, cur->rqr); | 
| 56 | printf("\n"); | 
| 57 | |
| 58 | } | 
  Note:
 See   TracBrowser
 for help on using the repository browser.
    