| 11 | }; |
| 12 | |
| 13 | constexpr std::array<int32_t, 2> quoRem(int32_t dividend, int32_t divisor) |
| 14 | { |
| 15 | using namespace matchit; |
| 16 | Id<int32_t> q; |
| 17 | Id<int32_t> r; |
| 18 | return match(dividend)( |
| 19 | // clang-format off |
| 20 | pattern | qr(divisor)(q, r) = [&] { return std::array<int32_t, 2>{*q, *r}; }, |
| 21 | pattern | _ = [&] { return std::array<int32_t, 2>{0, 0}; } |
| 22 | // clang-format on |
| 23 | ); |
| 24 | } |
| 25 | |
| 26 | constexpr auto qrResult1 = quoRem(12, 6); |
| 27 | static_assert(qrResult1[0] == 2); |
no test coverage detected