similar
. You
have the option of using the similarTo
member function,
which does allow a default tolerance.
Unit2D< Length > length(MetersLength(5),
MetersLength(7));
// Compute velocity.
Unit2D< Speed > velocity = length / SecondsTime(2);
Instead, you must compute the individual components:
// Compute velocity.
Unit2D< Speed > velocity(length.x() / SecondsTime(2),
length.y() / SecondsTime(2));
similar
. You
have the option of using the similarTo
member function,
which does allow a default tolerance.
Unit2D< Speed > speed(KnotsSpeed(200), KnotsSpeed(-200));
cout << Speed2DFormat< KnotsSpeed >(speed) << endl; // error
For now, you must do the formatting yourself:
cout << '(' << KnotsSpeed(speed.x()).value()
<< ", " << KnotsSpeed(speed.y()).value()
<< ") " << KnotsSpeed::unitsString << endl;