Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ if_else() [1/4]

template<typename T_true , typename T_false >
return_type_t< T_true, T_false > stan::math::if_else ( const bool  c,
const T_true  y_true,
const T_false  y_false 
)
inline

Return the second argument if the first argument is true and otherwise return the second argument.

This is just a convenience method to provide a function with the same behavior as the built-in ternary operator. In general, this function behaves as if defined by

if_else(c, y1, y0) = c ? y1 : y0.

Template Parameters
T_truetype of the true argument
T_falsetype of the false argument
Parameters
cBoolean condition value.
y_trueValue to return if condition is true.
y_falseValue to return if condition is false.

Definition at line 26 of file if_else.hpp.