This will become handy in future commits.
#ifdef CUFFT
T *ptr_d = nullptr;
#endif
#ifdef CUFFT
T *ptr_d = nullptr;
#endif
public:
typedef T value_type;
public:
typedef T value_type;
+ const size_t num_elem;
+
DynMem_(size_t num_elem) : num_elem(num_elem)
{
#ifdef CUFFT
DynMem_(size_t num_elem) : num_elem(num_elem)
{
#ifdef CUFFT
ptr_h = new T[num_elem];
#endif
}
ptr_h = new T[num_elem];
#endif
}
- DynMem_(DynMem_&& other) {
+ DynMem_(DynMem_ &&other) : num_elem(other.num_elem)
+ {
ptr_h = other.ptr_h;
other.ptr_h = nullptr;
#ifdef CUFFT
ptr_h = other.ptr_h;
other.ptr_h = nullptr;
#ifdef CUFFT
T *deviceMem() { return ptr_d; }
#endif
void operator=(DynMem_ &rhs) {
T *deviceMem() { return ptr_d; }
#endif
void operator=(DynMem_ &rhs) {
+ assert(num_elem == rhs.num_elem);
memcpy(ptr_h, rhs.ptr_h, num_elem * sizeof(T));
}
void operator=(DynMem_ &&rhs)
{
memcpy(ptr_h, rhs.ptr_h, num_elem * sizeof(T));
}
void operator=(DynMem_ &&rhs)
{
+ assert(num_elem == rhs.num_elem);
ptr_h = rhs.ptr_h;
rhs.ptr_h = nullptr;
#ifdef CUFFT
ptr_h = rhs.ptr_h;
rhs.ptr_h = nullptr;
#ifdef CUFFT