I'm trying to find a way to replicate the behavior in hlsl where the ternary operator actually selects the bits that evaluate the condition, i.e instead of evaluating to bool they evaluate to bool4. Something like the following code:
float4 condition = float4(1, 0, 1, 0);
float4 a = float4(2, 2, 2, 2);
float4 b = float4(3, 3, 3, 3);
float4 c = condition > 0 ? a : b;
c becomes (2, 3, 2, 3)
However, the C++ ternary operator needs a bool and selects only one of the values. I think this is a legit scenario where overloading the ternary operator is desired.
Is there absolutely no way to get this behavior in C++?
UPDATE [23/12/2019] Apparently I'm not the only one with this issue, and for the same reason as explained in this paper http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0917r3.pdf
We'll probably get it at some point for the bleeding edge of C++, better late than never I guess.