NRVec concatenation implemented

This commit is contained in:
2021-10-22 13:28:13 +02:00
parent d1a43830fc
commit 1bfb548835
2 changed files with 53 additions and 1 deletions

12
vec.h
View File

@@ -222,7 +222,17 @@ public:
inline const NRVec operator-(const T &a) const;
inline const NRVec operator*(const T &a) const;
inline const NRVec operator/(const T &a) const;
//!concatenate vectors
NRVec concat(const NRVec &rhs) const
{
if(nn==0) return rhs;
if(rhs.nn==0) return *this;
NRVec r(nn+rhs.nn);
for(int i=0; i<nn; ++i) r[i] = (*this)[i];
for(int i=0; i<rhs.nn; ++i) r[nn+i] = rhs[i];
return r;
}
//! determine the actual value of the reference counter
inline int getcount() const {return count?*count:0;}