operator!= for nested types

This commit is contained in:
Jiri Pittner 2021-06-24 17:08:55 +02:00
parent cc65575536
commit 9ce8e74e19
2 changed files with 15 additions and 1 deletions

5
vec.cc
View File

@ -969,10 +969,15 @@ return m;\
INSTANTIZE_NONCOMPLEX(char)
INSTANTIZE_NONCOMPLEX(unsigned char)
INSTANTIZE_NONCOMPLEX(short)
INSTANTIZE_NONCOMPLEX(unsigned short)
INSTANTIZE_NONCOMPLEX(int)
INSTANTIZE_NONCOMPLEX(unsigned int)
INSTANTIZE_NONCOMPLEX(long)
INSTANTIZE_NONCOMPLEX(unsigned long)
INSTANTIZE_NONCOMPLEX(long long)
INSTANTIZE_NONCOMPLEX(unsigned long long)
INSTANTIZE_NONCOMPLEX(float)
INSTANTIZE_NONCOMPLEX(double)

11
vec.h
View File

@ -170,7 +170,16 @@ public:
NRVec& operator|=(const NRVec &rhs);
//! relational operators
const bool operator!=(const NRVec &rhs) const {if(nn!=rhs.nn) return 1; return LA_traits<T>::gencmp(v,rhs.v,nn);}
const bool operator!=(const NRVec &rhs) const
{
if(nn!=rhs.nn) return 1;
if(LA_traits<T>::is_plaindata()) return LA_traits<T>::gencmp(v,rhs.v,nn);
else
{
for(int i=0; i<nn; ++i) if(v[i]!=rhs.v[i]) return 1;
return 0;
}
}
const bool operator==(const NRVec &rhs) const {return !(*this != rhs);};
const bool operator>(const NRVec &rhs) const;
const bool operator<(const NRVec &rhs) const;