On 07/15/17 15:47, Peter Dimov via Boost wrote:
Vinnie Falco wrote:
* The documentation states: "mp_if_c
is an alias for T. mp_if_c is an alias for E. Otherwise, the result is a substitution failure." Should that read "mp_if_c
"? If not, why? No.
The idea here is that mp_if_c can be used in two ways. One is mp_if_c
, which gives either T or E depending on Cond. The other is mp_if_c , which is the same as std::enable_if_t - gives T when Cond, otherwise a substitution failure. So
mp_if_c
is T mp_if_c is T mp_if_c is E Aliases can't be specialized, so it's not possible to implement just the above, which is why it takes a parameter pack for E... and does
mp_if_c
is T mp_if_c is E which for the three cases we're interested in gives the results we need.
Why not separate the two use case into two primitives? We usually want one or the other and different tools would make sense, at least for documenting purpose.