1 | #include <cstdio> |
2 | #include <deque> |
3 | |
4 | struct Foo_small { |
5 | int a; |
6 | int b; |
7 | int c; |
8 | |
9 | Foo_small(int a, int b, int c) : a(a), b(b), c(c) {} |
10 | }; |
11 | |
12 | struct Foo_large { |
13 | int a; |
14 | int b; |
15 | int c; |
16 | char d[1000] = {0}; |
17 | |
18 | Foo_large(int a, int b, int c) : a(a), b(b), c(c) {} |
19 | }; |
20 | |
21 | template <typename T> T fill(T deque) { |
22 | for (int i = 0; i < 100; i++) { |
23 | deque.push_back({i, i + 1, i + 2}); |
24 | deque.push_front({-i, -(i + 1), -(i + 2)}); |
25 | } |
26 | return deque; |
27 | } |
28 | |
29 | int main() { |
30 | std::deque<int> empty; |
31 | std::deque<int> deque_1 = {1}; |
32 | std::deque<int> deque_3 = {3, 1, 2}; |
33 | |
34 | std::deque<Foo_small> deque_200_small; |
35 | deque_200_small = fill<std::deque<Foo_small>>(deque: deque_200_small); |
36 | |
37 | std::deque<Foo_large> deque_200_large; |
38 | deque_200_large = fill<std::deque<Foo_large>>(deque: deque_200_large); |
39 | |
40 | return empty.size() + deque_1.front() + deque_3.front(); // break here |
41 | } |
42 | |