Stan Math Library: stan/math/prim/scal/meta/scalar_type.hpp Source File

| Stan Math Library 2.10.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
9 namespace {
10 template <bool is_vec, typename T>
11 struct scalar_type_helper {
12 typedef T type;
13 };
14
15 template <typename T>
16 struct scalar_type_helper<true, T> {
17 typedef typename
18 scalar_type_helper<is_vector<typename
19 stan::math::value_type<T>::type>::value,
20 typename stan::math::value_type<T>::type>::type
21 type;
22 };
23 }
24
33 template <typename T>
34 struct scalar_type {
35 typedef typename scalar_type_helper<is_vector<T>::value, T>::type type;
36 };
37
38 template <typename T>
39 struct scalar_type<T*> {
40 typedef typename scalar_type<T>::type type;
41 };
42
43 }
44 #endif
stan::scalar_type< T * >::type
scalar_type< T >::type type
Definition: scalar_type.hpp:40
stan::scalar_type
Metaprogram structure to determine the base scalar type of a template argument.
Definition: scalar_type.hpp:34
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:35
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.