Write aMeasure_addtrait that takes twoMeasuretraits as template parameters, converts them to the common smaller unit and adds them together.
Measure_add
Measure
TheMeasure_addtrait should provide exactly the same internal structure as theMeasuretrait. That is, ifMeasurehas two attributesvalueandunitthenMeasure_addshould have the same attributes.
value
unit
Hint:You might want to implement additional traits, e.g., to check if twoMeasurehave the sameunit, and therefore, no conversion is necessary and/or a trait that calculates the factor by which theMeasurewith the higherunitneeds to be multiplied to convert it into the lowerunit.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here