AFF --- A container for numbers (array) by Friederich and Forbriger.
deepcopy.h
Go to the documentation of this file.
1 
45 // include guard
46 #ifndef AFF_DEEPCOPY_H_VERSION
47 
48 #define AFF_DEEPCOPY_H_VERSION \
49  "AFF_DEEPCOPY_H V1.2"
50 
51 namespace aff {
52 
64  template<class S, class T>
65  void deepcopy(const S& source, T& target)
66  {
67  // acces source through container of const (read only access)
68  typedef typename S::Tcontainer::Tcoc Tscoc;
69  typedef typename Tscoc::Trepresentation Tsrep;
70  typedef typename Tscoc::Tstepper Tsstp;
71  // access types for target
72  typedef typename T::Tcontainer Ttcon;
73  typedef typename Ttcon::Trepresentation Ttrep;
74  typedef typename Ttcon::Tstepper Ttstp;
75  // alias for source and target
76  const Tscoc& csource(source);
77  Ttcon ctarget(target);
78  // representations
79  Tsrep srep(csource.representation());
80  Ttrep trep(ctarget.representation());
81  // steppers
82  Tsstp sstp(csource.shape());
83  Ttstp tstp(ctarget.shape());
84  sstp.tofirst();
85  tstp.tofirst();
86  while (sstp.valid() && tstp.valid())
87  {
88  trep[tstp.current()]=srep[sstp.current()];
89  tstp.incr();
90  sstp.incr();
91  }
92  } // deepcopy
93 
94 } // namespace aff
95 
96 #endif // TF_DEEPCOPY_H_VERSION (includeguard)
97 
98 /* ----- END OF deepcopy.h ----- */
Root namespace of library.
Definition: array.h:148
void deepcopy(const S &source, T &target)
deep copy
Definition: deepcopy.h:65