nholthaus / units

a compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies.
http://nholthaus.github.io/units/
MIT License
947 stars 135 forks source link

Simplify `unit::toLinearized` #193

Closed JohelEGP closed 5 years ago

JohelEGP commented 5 years ago

By defaulting units::toLinearized's return type to the unit's underlying_type, call sites that don't need something else get simpler.

What do you think about simplifying it further, so that it's not a template function? Changing x.template toLinearized<Arithmetic>() for static_cast<Arithmetic>(x.toLinearized()) is, I believe, more clear on the intention and easier to read at call site.

nholthaus commented 5 years ago

yeah, removing the template would be more idiomatic.

JohelEGP commented 5 years ago

yeah, removing the template would be more idiomatic.

Am I correct to assume that you agree with the "further simplification" as posted in the second part of the OP? I'm asking because I was going to implement that.

The commit for (manually) closing this PR looks wrong and doesn't include a part of the changes, presumably due to the conflicts (for having added linearized_value).

nholthaus commented 5 years ago

yes agree to the second part. go ahead and deconflict as much as you can, especially #150.

On Fri, Oct 26, 2018 at 2:41 PM Johel Ernesto Guerrero Peña < notifications@github.com> wrote:

yeah, removing the template would be more idiomatic.

Am I correct to assume that you agree with the "further simplification" as posted in the second part of the OP? I'm asking because I was going to implement that.

The commit for (manually) closing this PR looks wrong and doesn't include a part of the changes, presumably due to the conflicts (for having added linearized_value).

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/nholthaus/units/pull/193#issuecomment-433505890, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ2HH9FxjIcuQTefAdbxftQ32br3ekp2ks5uo1dygaJpZM4XMG-H .