Stan Math Library  2.15.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 
4 #include <boost/math/tools/promotion.hpp>
5 
6 namespace stan {
7  namespace math {
8 
23  template <typename T_true, typename T_false>
24  inline typename boost::math::tools::promote_args<T_true, T_false>::type
25  if_else(const bool c, const T_true y_true, const T_false y_false) {
26  return c ? y_true : y_false;
27  }
28 
29  }
30 }
31 
32 #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–2016, Stan Development Team.