Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
primitive_value.hpp
Go to the documentation of this file.
1 #ifndef STAN__MATH__FUNCTIONS__PRIMITIVE_VALUE_HPP
2 #define STAN__MATH__FUNCTIONS__PRIMITIVE_VALUE_HPP
3 
4 #include <boost/utility/enable_if.hpp>
5 #include <boost/type_traits/is_arithmetic.hpp>
7 
8 namespace stan {
9 
10  namespace math {
11 
27  template <typename T>
28  inline
29  typename boost::enable_if<boost::is_arithmetic<T>, T>::type
31  return x;
32  }
33 
44  template <typename T>
45  inline
46  typename boost::disable_if<boost::is_arithmetic<T>, double>::type
47  primitive_value(const T& x) {
49  return value_of(x);
50  }
51 
52  }
53 
54 }
55 
56 #endif
double value_of(const T x)
Return the value of the specified scalar argument converted to a double value.
Definition: value_of.hpp:24
boost::enable_if< boost::is_arithmetic< T >, T >::type primitive_value(T x)
Return the value of the specified arithmetic argument unmodified with its own declared type...

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