You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a specification of the Quantity class, the wrong operator is used for multiplication and division of two such specifications.
Instead of the operator which calculates two quantities, the operator which uses only one quantity and one template parameter is used.
In the overloaded binary and assignment operators, which are handling a typename and a quantity, a fourth template parameter was added.
The fourth template parameter enables the function only if the typename is convertible to the underlying type of the quantity.
For example:
template< typename D, typename X, typename Y, typename = std::enable_if_t<std::is_convertible<Y,X>::value>>
constexpr quantity<D, X> &
operator/=( quantity<D, X> & x, const Y & y )
The text was updated successfully, but these errors were encountered:
When using a specification of the Quantity class, the wrong operator is used for multiplication and division of two such specifications.
Instead of the operator which calculates two quantities, the operator which uses only one quantity and one template parameter is used.
Instead of
the following operators are used, e.g.:
Proposed sloution
In the overloaded binary and assignment operators, which are handling a typename and a quantity, a fourth template parameter was added.
The fourth template parameter enables the function only if the typename is convertible to the underlying type of the quantity.
For example:
The text was updated successfully, but these errors were encountered: