fixed bug in nrvec::concatme

This commit is contained in:
2022-06-21 17:33:16 +02:00
parent e8641c2833
commit 2621f444e1
2 changed files with 17 additions and 4 deletions

8
vec.h
View File

@@ -244,14 +244,18 @@ public:
//!concatenate vector into *this
void concatme(const NRVec &rhs)
{
NOT_GPU(*this);
if(rhs.nn==0) return;
int nnold=nn;
resize(nn+rhs.nn,true);
for(int i=0; i<rhs.nn; ++i) *(this)[nn+i] = rhs[i];
for(int i=0; i<rhs.nn; ++i) v[nnold+i] = rhs[i];
}
void append(const T &a) //not efficient if done repeatedly
{
NOT_GPU(*this);
int nnold=nn;
resize(nn+1,true);
(*this)[nn] = a;
v[nnold] = a;
}
//! determine the actual value of the reference counter