1 #ifndef STAN_MATH_PRIM_FUN_AS_VALUE_ARRAY_OR_SCALAR_HPP
2 #define STAN_MATH_PRIM_FUN_AS_VALUE_ARRAY_OR_SCALAR_HPP
3 
4 #include <stan/math/prim/fun/Eigen.hpp>
5 #include <stan/math/prim/meta.hpp>
6 #include <stan/math/prim/fun/as_array_or_scalar.hpp>
7 #include <stan/math/prim/fun/value_of.hpp>
8 #include <vector>
9 
10 namespace stan {
11 namespace math {
12 
13 /**
14  * Extract the value from an object. For eigen types and `std::vectors`
15  * convert to an eigen array and for scalars return a scalar.
16  * @tparam T A stan scalar, eigen vector, or `std::vector`.
17  * @param v Specified value.
18  * @return Same value.
19  */
20 template <typename T>
as_value_array_or_scalar(T && v)21 inline auto as_value_array_or_scalar(T&& v) {
22   return value_of(as_array_or_scalar(std::forward<T>(v)));
23 }
24 
25 }  // namespace math
26 }  // namespace stan
27 
28 #endif
29