| 13 | } |
| 14 | |
| 15 | void sample2() |
| 16 | { |
| 17 | // Dynamic size |
| 18 | auto const v = std::vector<int32_t>{1, 2, 3}; |
| 19 | Id<int32_t> a, b, c; |
| 20 | match(v)( |
| 21 | // format off |
| 22 | pattern | ds(a, b) = |
| 23 | [] { /* this arm will not apply because the length doesn't match */ }, |
| 24 | pattern | ds(a, b, c) = [] { /* this arm will apply */ }, |
| 25 | pattern | ds(_) = |
| 26 | [] { /* this wildcard is required, since the length is not known |
| 27 | statically */ |
| 28 | } // format on |
| 29 | ); |
| 30 | } |
| 31 | |
| 32 | int32_t main() |
| 33 | { |