aimstil  5.0.5
ghost_array.h
Go to the documentation of this file.
1 #ifndef GHOST_ARRAY_H_
2 #define GHOST_ARRAY_H_
3 
4 // include from BOOST
5 #include "boost/array.hpp"
6 
7 namespace til
8 {
9 
10  template < typename T, std::size_t D >
12  {
13  public: // typedefs
14 
15  typedef T value_type;
16  typedef T & reference;
17  typedef const T & const_reference;
18  typedef T * iterator;
19  typedef const T * const_iterator;
20 
21  public: //
22  ghost_array(T * t) : m_(t) {}
23 
24  iterator begin() { return m_; }
25  iterator end() { return m_ + D; }
26  const_iterator begin() const { return m_; }
27  const_iterator end() const { return m_ + D; }
28 
29  const_reference operator[](std::size_t i) const { return *(m_+i); }
30  reference operator[](std::size_t i) { return *(m_+i); }
31 
32  operator boost::array<T,D> () const
33  {
35  std::copy(this->begin(), this->end(), res.begin());
36  return res;
37  }
38 
39  private: // data
40  T * m_;
41  };
42 
43 }
44 
45 #endif /*GHOST_ARRAY_H_*/
iterator begin()
Definition: ghost_array.h:24
Belongs to package Box Do not include directly, include til/Box.h instead.
Definition: Accumulator.h:10
reference operator[](std::size_t i)
Definition: ghost_array.h:30
const T & const_reference
Definition: ghost_array.h:17
const_iterator begin() const
Definition: ghost_array.h:26
const T * const_iterator
Definition: ghost_array.h:19
void copy(const TImage &in, TImage &out)
Copy one image to another.
Definition: imageTools.h:133
const_reference operator[](std::size_t i) const
Definition: ghost_array.h:29
iterator end()
Definition: ghost_array.h:25
const_iterator end() const
Definition: ghost_array.h:27