NRVec concatme and append

This commit is contained in:
Jiri Pittner 2022-06-09 13:56:42 +02:00
parent 12585b0bd3
commit e396a8ccd9
1 changed files with 13 additions and 0 deletions

13
vec.h
View File

@ -241,6 +241,19 @@ public:
return r;
}
//!concatenate vector into *this
void concatme(const NRVec &rhs)
{
if(rhs.nn==0) return;
resize(nn+rhs.nn,true);
for(int i=0; i<rhs.nn; ++i) *(this)[nn+i] = rhs[i];
}
void append(const T &a) //not efficient if done repeatedly
{
resize(nn+1,true);
(*this)[nn] = a;
}
//! determine the actual value of the reference counter
inline int getcount() const {return count?*count:0;}