Update change_speed example in P.1 to use user-defined literal syntax (#1778)

Co-authored-by: Bill Rose <neptoess@gmail.com>
This commit is contained in:
Bill Rose
2021-05-13 14:30:53 -04:00
committed by GitHub
parent 2541e809b6
commit 8a0053d671

View File

@@ -551,7 +551,7 @@ A better approach is to be explicit about the meaning of the double (new speed o
change_speed(Speed s); // better: the meaning of s is specified
// ...
change_speed(2.3); // error: no unit
change_speed(23m / 10s); // meters per second
change_speed(23_m / 10s); // meters per second
We could have accepted a plain (unit-less) `double` as a delta, but that would have been error-prone.
If we wanted both absolute speed and deltas, we would have defined a `Delta` type.