Stan Math Library  2.10.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 
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
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
scalar_type< T >::type type
Definition: scalar_type.hpp:40
Metaprogram structure to determine the base scalar type of a template argument.
Definition: scalar_type.hpp:34
scalar_type_helper< is_vector< T >::value, T >::type type
Definition: scalar_type.hpp:35
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.