mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
[PQ] Add unary minus operator
This commit is contained in:
@@ -237,6 +237,14 @@ namespace BlackMisc
|
||||
return copy;
|
||||
}
|
||||
|
||||
template <class MU, class PQ>
|
||||
PQ CPhysicalQuantity<MU, PQ>::operator -() const
|
||||
{
|
||||
PQ copy = *derived();
|
||||
copy *= -1;
|
||||
return copy;
|
||||
}
|
||||
|
||||
template <class MU, class PQ>
|
||||
bool CPhysicalQuantity<MU, PQ>::lessThan(const CPhysicalQuantity<MU, PQ> &other) const
|
||||
{
|
||||
|
||||
@@ -165,6 +165,9 @@ namespace BlackMisc
|
||||
//! Operator /
|
||||
PQ operator /(double divide) const;
|
||||
|
||||
//! Unary operator -
|
||||
PQ operator -() const;
|
||||
|
||||
//! Equal operator ==
|
||||
friend bool operator==(const CPhysicalQuantity &a, const CPhysicalQuantity &b) { return a.equals(b); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user