mp-units icon indicating copy to clipboard operation
mp-units copied to clipboard

Bikeshedding `force_in(Unit)`

Open mpusz opened this issue 6 months ago • 10 comments

As we discussed before, the spelling of distance.force_in(si::metre) may be confusing. Also, the C++ standard does not use "force" word anywhere to force a conversion.

AU library is using coerse_in(Unit) for that reason but I personally do not think it helps here.

I just thought about renaming it to cast_to(si::metre). Lets see some examples:

quantity q1 = 42 * m;
quantity q2 = q1.in(mm);
quantity q3 = q1.cast_to(km);
quantity q4 = q1.numerical_value_in(mm);
quantity q5 = q1.cast_numerical_value_to(km);
quantity q6 = q1.numerical_value_cast_to(km);

What do you think of the above? Which one looks better to you, q5 or q6?

mpusz avatar Dec 23 '23 13:12 mpusz