Stan Math Library  2.20.0
reverse mode automatic differentiation
if_else.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_IF_ELSE_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_IF_ELSE_HPP
3 
5 #include <boost/math/tools/promotion.hpp>
6 
7 namespace stan {
8 namespace math {
9 
24 template <typename T_true, typename T_false>
25 inline typename boost::math::tools::promote_args<T_true, T_false>::type if_else(
26  const bool c, const T_true y_true, const T_false y_false) {
27  return c ? y_true : y_false;
28 }
29 
30 } // namespace math
31 } // namespace stan
32 
33 #endif
boost::math::tools::promote_args< T_true, T_false >::type if_else(const bool c, const T_true y_true, const T_false y_false)
Return the second argument if the first argument is true and otherwise return the second argument...
Definition: if_else.hpp:25

     [ Stan Home Page ] © 2011–2018, Stan Development Team.