What's the constexpr-if equivalent to `condition ? x : y`? As far as I know we only have `[&] { if constexpr (condition) return x; else return y; }()`. I hate it.

#cpp #cplusplus #WG21

@mkretz I might have a knot in my head, but couldn't you just do a simple constexpr operator? overload?
@funkylab Oh if I could overload `operator?:` I'd be dancing for joy. No I still have to get that paper through WG21/EWG.
But it wouldn't help. An operator can not return a different type depending on its function arguments. (unless you make the condition a `std::cw<condition>`/true_type/false_type ... interesting ... another pattern to add to my "make ?: overloadable" paper?)
@mkretz I thought the conditional operator was the singular exception to that rule; `auto val = condition ? 12 : std::string{"oats"};`
the type of `val` very much depends on the value of `condition`. Indeed, a bit annoying you can't overload that now that this type system exception exists.
@funkylab No, the type of `val` is the common type of the two expressions following the `?`. That's why `std::common_type<T, U>` is defined in terms of `?:`.
@mkretz uff yes; and I feel like I've stumbled across this very same thing before