Stan Math Library  2.8.0
reverse mode automatic differentiation
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
container_view.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_ARR_META_CONTAINER_VIEW_HPP
2 #define STAN_MATH_PRIM_ARR_META_CONTAINER_VIEW_HPP
3 
5 #include <vector>
6 
7 namespace stan {
8 
9  namespace math {
10 
19  template <typename T1, typename T2>
20  class container_view<std::vector<T1>, T2> {
21  public:
28  container_view(const std::vector<T1>& x, T2* y)
29  : y_(y) { }
30 
37  T2& operator[](int i) {
38  return y_[i];
39  }
40  private:
41  T2* y_;
42  };
43  }
44 }
45 
46 #endif
container_view(const std::vector< T1 > &x, T2 *y)
Constructor.
T2 & operator[](int i)
operator[](int i) returns reference to scalar view indexed at i
Primary template class for container view of array y with same structure as T1 and size as x...

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