fix self operators (+=, -=)

This commit is contained in:
Christian Zimmermann 2019-02-16 18:24:32 +01:00
parent 697aac6b94
commit 54688698c8

View file

@ -219,7 +219,10 @@ namespace MultiArrayTools
} }
else { else {
assert( PackNum<sizeof...(SRanges)-1>::checkIfSameInstance( MAB::mRange->space(), in.mRange->space() ) ); assert( PackNum<sizeof...(SRanges)-1>::checkIfSameInstance( MAB::mRange->space(), in.mRange->space() ) );
std::transform(mCont.begin(), mCont.end(), in.mCont.begin(), mCont.begin(), std::plus<T>()); for(size_t i = 0; i != size(); ++i){
mCont[i] += in.mCont[i];
}
//std::transform(mCont.begin(), mCont.end(), in.mCont.begin(), mCont.begin(), std::plus<T>());
} }
return *this; return *this;
} }
@ -232,7 +235,10 @@ namespace MultiArrayTools
} }
else { else {
assert( PackNum<sizeof...(SRanges)-1>::checkIfSameInstance( MAB::mRange->space(), in.mRange->space() ) ); assert( PackNum<sizeof...(SRanges)-1>::checkIfSameInstance( MAB::mRange->space(), in.mRange->space() ) );
std::transform(mCont.begin(), mCont.end(), in.mCont.begin(), mCont.begin(), std::minus<T>()); for(size_t i = 0; i != size(); ++i){
mCont[i] -= in.mCont[i];
}
//std::transform(mCont.begin(), mCont.end(), in.mCont.begin(), mCont.begin(), std::minus<T>());
} }
return *this; return *this;
} }