| Stan Math Library 2.6.3 probability, sampling & optimization

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
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 <stan/math/prim/mat/meta/is_vector.hpp>
6 #include <stan/math/prim/arr/meta/is_vector.hpp>
7
8 namespace stan {
9
10
11
12 template<typename T, bool is_vec>
13 struct size_of_helper {
14 static size_t size_of(const T& /*x*/) {
15 return 1U;
16 }
17 };
18
19 template<typename T>
20 struct size_of_helper<T, true> {
21 static size_t size_of(const T& x) {
22 return x.size();
23 }
24 };
25
26 template <typename T>
27 size_t size_of(const T& x) {
28 return size_of_helper<T, is_vector<T>::value>::size_of(x);
29 }
30
31 }
32 #endif
33
stan::size_of_helper::size_of
static size_t size_of(const T &)
Definition: size_of.hpp:14
stan::size_of_helper< T, true >::size_of
static size_t size_of(const T &x)
Definition: size_of.hpp:21
is_vector.hpp
is_vector.hpp
stan::size_of_helper
Definition: size_of.hpp:13
stan::size_of
size_t size_of(const T &x)
Definition: size_of.hpp:27
is_vector.hpp

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