Don't return values from update operators.

Statements like

   a = b += c

make no sense
This commit is contained in:
Bård Skaflestad 2013-04-30 10:47:00 +02:00
parent 0ff3b721ee
commit 6319c428a3

View File

@ -50,74 +50,58 @@ namespace AutoDiff {
: val_(x), der_(dx)
{}
Forward&
void
operator +=(const Scalar& rhs)
{
val_ += rhs;
return *this;
}
Forward&
void
operator +=(const Forward& rhs)
{
val_ += rhs.val_;
der_ += rhs.der_;
return *this;
}
Forward&
void
operator -=(const Scalar& rhs)
{
val_ -= rhs;
return *this;
}
Forward&
void
operator -=(const Forward& rhs)
{
val_ -= rhs.val_;
der_ -= rhs.der_;
return *this;
}
Forward&
void
operator *=(const Scalar& rhs)
{
val_ *= rhs;
der_ *= rhs;
return *this;
}
Forward&
void
operator *=(const Forward& rhs)
{
der_ = der_*rhs.val_ + val_*rhs.der_;
val_ *= rhs.val_;
return *this;
}
Forward&
void
operator /=(const Scalar& rhs)
{
val_ /= rhs;
der_ /= rhs;
return *this;
}
Forward&
void
operator /=(const Forward& rhs)
{
der_ = (der_*rhs.val_ - val_*rhs.der_) / (rhs.val_ * rhs.val_);
val_ /= rhs.val_;
return *this;
}
template <class Ostream>