G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsStdVectorRef.h
Go to the documentation of this file.
1 
14 #pragma once
15 
16 namespace gismo
17 {
18 
26 template<class obj>
28 {
29 public:
30 
32  inline gsStdVectorRef(const std::vector<obj> & refVec) :
33  m_ref(refVec)
34  { }
35 
36 
38  inline const obj & operator[](size_t i) const
39  { return m_ref[i]; }
40 
42  inline operator const std::vector<obj> & () const
43  { return m_ref; }
44 
46  inline operator const obj &() const
47  { return m_ref.front(); }
48 
50  inline const obj & front() const
51  { return m_ref.front(); }
52 
54  inline const obj & back () const
55  { return m_ref.back(); }
56 
58  inline size_t size () const
59  { return m_ref.size(); }
60 
61 private:
62  const std::vector<obj> & m_ref;
63 
64 private:
67 };
68 
69 
70 } // namespace gismo
Simple wrapper class for a vector of objects.
Definition: gsStdVectorRef.h:27
const obj & operator[](size_t i) const
Accessor.
Definition: gsStdVectorRef.h:38
size_t size() const
Size.
Definition: gsStdVectorRef.h:58
const obj & back() const
Back.
Definition: gsStdVectorRef.h:54
gsStdVectorRef(const std::vector< obj > &refVec)
Constructor from a vector of objs.
Definition: gsStdVectorRef.h:32
const obj & front() const
Front.
Definition: gsStdVectorRef.h:50