casacore
Memory.h
Go to the documentation of this file.
1 #ifndef CASACORE_COPY_2_H
2 #define CASACORE_COPY_2_H
3 
4 #include <cstring>
5 
6 namespace casacore { //#Begin casa namespace
7 
8 template<typename T>
9 void copy_n_with_stride(const T* from, std::size_t n, T* to,
10  std::size_t toStride, std::size_t fromStride)
11 {
12  while (n--)
13  {
14  *to = *from;
15  to += toStride;
16  from += fromStride;
17  }
18 }
19 
20 template<typename T>
21 void move_n_with_stride(T* from, std::size_t n, T* to,
22  std::size_t toStride, std::size_t fromStride)
23 {
24  while (n--)
25  {
26  *to = std::move(*from);
27  to += toStride;
28  from += fromStride;
29  }
30 }
31 
32 template<typename T>
33 void fill_n_with_stride(T* dest, size_t n, const T& value, size_t stride)
34 {
35  while (n--)
36  {
37  *dest = value;
38  dest += stride;
39  };
40 }
41 
42 } // namespaces
43 
44 #endif
this file contains all the compiler specific defines
Definition: mainpage.dox:28
void fill_n_with_stride(T *dest, size_t n, const T &value, size_t stride)
Definition: Memory.h:33
void move_n_with_stride(T *from, std::size_t n, T *to, std::size_t toStride, std::size_t fromStride)
Definition: Memory.h:21
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
void copy_n_with_stride(const T *from, std::size_t n, T *to, std::size_t toStride, std::size_t fromStride)
Definition: Memory.h:9