Open mattkretz opened 7 years ago
The above has a problem with deduction of Vs...
since the pack is not at the end of the function parameter list. After moving it, a call would look like:
where(v1 > 0, [&](auto &&v1masked, auto &&v2masked) {
v1masked = 1 / v1masked; // division is guaranteed to be masked
v1 = 1 / v1masked; // ill-formed: if you want masked assignment, mask the LHS
}, [&](auto &&v1masked, auto &&v2masked) {
v2masked += 1;
}, v1, v2);
In addition I believe the implicit meaning of the two callables is suboptimal.
where(v1 > 0, v1, v2)
.apply([&](auto &&v1masked, auto &&v2masked) {
v1masked = 1 / v1masked; // division is guaranteed to be masked
v1 = 1 / v1masked; // ill-formed: if you want masked assignment, mask the LHS
})
.apply_inv([&](auto &&v1masked, auto &&v2masked) {
v2masked += 1;
});
@phalpern What do you think of https://github.com/VcDevel/Vc/blob/4a333e9b856e4b26b7498530c89edd1e902d254e/tests/experimental.cpp#L47-L49? If you like it I'll look into a small extension paper to LEWG. Your suggestion had the problem that the parameter pack isn't deducible. Also the meaning of the two lambdas as last and second to last argument was not obvious enough, IMHO.