| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

size_of.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_META_SIZE_OF_HPP
2 #define STAN_MATH_PRIM_SCAL_META_SIZE_OF_HPP
3
4 #include <stan/math/prim/scal/meta/is_vector.hpp>
5 #include <cstddef>
6
7 namespace stan {
8
9 template<typename T, bool is_vec>
10 struct size_of_helper {
11 static size_t size_of(const T& /*x*/) {
12 return 1U;
13 }
14 };
15
16 template<typename T>
17 struct size_of_helper<T, true> {
18 static size_t size_of(const T& x) {
19 return x.size();
20 }
21 };
22
23 template <typename T>
24 size_t size_of(const T& x) {
25 return size_of_helper<T, is_vector<T>::value>::size_of(x);
26 }
27
28 }
29 #endif
30
stan::size_of_helper::size_of
static size_t size_of(const T &)
Definition: size_of.hpp:11
stan
Definition: log_sum_exp.hpp:8
stan::size_of_helper< T, true >::size_of
static size_t size_of(const T &x)
Definition: size_of.hpp:18
is_vector.hpp
stan::size_of_helper
Definition: size_of.hpp:10
stan::size_of
size_t size_of(const T &x)
Definition: size_of.hpp:24

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