1 #ifndef STAN_MATH_PRIM_FUN_GET_REAL_HPP
2 #define STAN_MATH_PRIM_FUN_GET_REAL_HPP
3 
4 #include <stan/math/prim/meta.hpp>
5 #include <complex>
6 
7 namespace stan {
8 namespace math {
9 
10 /**
11  * Return the real component of the complex argument.
12  *
13  * @tparam T value type of complex argument
14  * @param[in] z complex value whose real component is extracted
15  * @return real component of argument
16  */
17 template <typename T>
get_real(const std::complex<T> & z)18 T get_real(const std::complex<T>& z) {
19   return z.real();
20 }
21 
22 }  // namespace math
23 }  // namespace stan
24 
25 #endif
26