MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / main

Function main

tests/StructuredBindingsHandler2Test.cpp:3–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include <cstdio>
2
3int main() {
4 struct SP
5 {
6 int x;
7 int y;
8 };
9
10 SP sp{1, 2};
11
12 auto[sx, sy] = sp;
13
14 class CP
15 {
16 public:
17 int x;
18 int y;
19 };
20
21 CP cp{1,2};
22
23 auto [ c1, c2 ] = cp;
24
25 printf("c1: %d c2: %d\n", cp.x, cp.y);
26 ++c1;
27 ++c2;
28 printf("c1: %d c2: %d\n", cp.x, cp.y);
29
30 auto& [ c3, c4 ] = cp;
31
32 printf("c3: %d c4: %d\n", cp.x, cp.y);
33 ++c3;
34 ++c4;
35 printf("c3: %d c4: %d\n", cp.x, cp.y);
36}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected