casacore
Loading...
Searching...
No Matches
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
6namespace casacore { // #Begin casa namespace
7
8template <typename T>
9void copy_n_with_stride(const T* from, std::size_t n, T* to, std::size_t toStride,
10 std::size_t fromStride) {
11 while (n--) {
12 *to = *from;
13 to += toStride;
14 from += fromStride;
15 }
16}
17
18template <typename T>
19void move_n_with_stride(T* from, std::size_t n, T* to, std::size_t toStride,
20 std::size_t fromStride) {
21 while (n--) {
22 *to = std::move(*from);
23 to += toStride;
24 from += fromStride;
25 }
26}
27
28template <typename T>
29void fill_n_with_stride(T* dest, size_t n, const T& value, size_t stride) {
30 while (n--) {
31 *dest = value;
32 dest += stride;
33 };
34}
35
36} // namespace casacore
37
38#endif
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
void fill_n_with_stride(T *dest, size_t n, const T &value, size_t stride)
Definition Memory.h:29
void move_n_with_stride(T *from, std::size_t n, T *to, std::size_t toStride, std::size_t fromStride)
Definition Memory.h:19
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:360
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