Make ArrayBase operator+=(scalar) and -=(scalar) use SelfCwiseBinaryOp optimization

This commit is contained in:
Gael Guennebaud
2013-08-19 16:40:50 +02:00
parent 127d7f2071
commit 2b15e00106
3 changed files with 21 additions and 5 deletions

View File

@@ -123,10 +123,8 @@ template<typename Derived> class ArrayBase
return internal::assign_selector<Derived,Derived>::run(derived(), other.derived());
}
Derived& operator+=(const Scalar& scalar)
{ return *this = derived() + scalar; }
Derived& operator-=(const Scalar& scalar)
{ return *this = derived() - scalar; }
Derived& operator+=(const Scalar& scalar);
Derived& operator-=(const Scalar& scalar);
template<typename OtherDerived>
Derived& operator+=(const ArrayBase<OtherDerived>& other);