Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify unit::toLinearized #193

Closed
wants to merge 1 commit into from

Conversation

JohelEGP
Copy link
Contributor

@JohelEGP JohelEGP commented Oct 8, 2018

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
Copy link
Owner

yeah, removing the template would be more idiomatic.

@JohelEGP JohelEGP changed the title Simplify units::toLinearized Simplify unit::toLinearized Oct 26, 2018
nholthaus pushed a commit that referenced this pull request Oct 26, 2018
@nholthaus nholthaus closed this Oct 26, 2018
@JohelEGP
Copy link
Contributor Author

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
Copy link
Owner

nholthaus commented Oct 26, 2018 via email

@JohelEGP JohelEGP deleted the simpler_to_linearized branch October 27, 2018 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants