Stan Math Library  2.14.0
reverse mode automatic differentiation
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 
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
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
scalar_type< T >::type type
Definition: scalar_type.hpp:39
Metaprogram structure to determine the base scalar type of a template argument.
Definition: scalar_type.hpp:33
scalar_type_helper< is_vector< T >::value, T >::type type
Definition: scalar_type.hpp:34
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.