| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

scalar_type.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_META_SCALAR_TYPE_HPP
2 #define STAN_MATH_PRIM_SCAL_META_SCALAR_TYPE_HPP
3
4 #include <stan/math/prim/scal/meta/is_vector.hpp>
5 #include <stan/math/prim/scal/meta/value_type.hpp>
6
7 namespace stan {
8 namespace {
9 template <bool is_vec, typename T>
10 struct scalar_type_helper {
11 typedef T type;
12 };
13
14 template <typename T>
15 struct scalar_type_helper<true, T> {
16 typedef typename
17 scalar_type_helper<is_vector<typename
18 stan::math::value_type<T>::type>::value,
19 typename stan::math::value_type<T>::type>::type
20 type;
21 };
22 }
23
32 template <typename T>
33 struct scalar_type {
34 typedef typename scalar_type_helper<is_vector<T>::value, T>::type type;
35 };
36
37 template <typename T>
38 struct scalar_type<T*> {
39 typedef typename scalar_type<T>::type type;
40 };
41
42 }
43 #endif
stan::scalar_type< T * >::type
scalar_type< T >::type type
Definition: scalar_type.hpp:39
stan::scalar_type
Metaprogram structure to determine the base scalar type of a template argument.
Definition: scalar_type.hpp:33
stan
Definition: log_sum_exp.hpp:8
is_vector.hpp
stan::scalar_type::type
scalar_type_helper< is_vector< T >::value, T >::type type
Definition: scalar_type.hpp:34
value_type.hpp
stan::math::value_type
Primary template class for metaprogram to compute the type of values stored in a container.
Definition: value_type.hpp:18

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