| 1 | class Point { |
| 2 | public: |
| 3 | int x; |
| 4 | int y; |
| 5 | Point(int a, int b): |
| 6 | x(a), |
| 7 | y(b) |
| 8 | {} |
| 9 | }; |
| 10 | |
| 11 | class Data { |
| 12 | public: |
| 13 | int id; |
| 14 | Point point; |
| 15 | Data(int i): |
| 16 | id(i), |
| 17 | point(0, 0) |
| 18 | {} |
| 19 | }; |
| 20 | |
| 21 | int main(int argc, char const *argv[]) { |
| 22 | Data *data[1000]; |
| 23 | Data **ptr = data; |
| 24 | for (int i = 0; i < 1000; ++i) { |
| 25 | ptr[i] = new Data(i); |
| 26 | ptr[i]->point.x = i; |
| 27 | ptr[i]->point.y = i+1; |
| 28 | } |
| 29 | |
| 30 | for (int i = 0; i < 1000; ++i) { |
| 31 | bool dump = argc > 1; // Set breakpoint here. |
| 32 | // Evaluate a couple of expressions (2*1000 = 2000 exprs): |
| 33 | // expr ptr[i]->point.x |
| 34 | // expr ptr[i]->point.y |
| 35 | } |
| 36 | return 0; |
| 37 | } |
| 38 | |