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

Co-authored-by: Bill Rose <neptoess@gmail.com>
pull/1788/head
Bill Rose 5 years ago committed by GitHub
parent 2541e809b6
commit 8a0053d671
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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.

Loading…
Cancel
Save