Stan Math Library  2.15.0
reverse mode automatic differentiation
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  namespace math {
9 
18  template <typename T1, typename T2>
19  class container_view<std::vector<T1>, T2> {
20  public:
27  container_view(const std::vector<T1>& x, T2* y)
28  : y_(y) { }
29 
36  T2& operator[](int i) {
37  return y_[i];
38  }
39  private:
40  T2* y_;
41  };
42  }
43 }
44 
45 #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–2016, Stan Development Team.