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
955 stars 135 forks source link

`NonLinearScale` triviality #243

Closed rbrugo closed 2 years ago

rbrugo commented 4 years ago

Hi, I've a design question for you: I can't understand why NonLinearScale must be a trivial type. I've read the code, but I couldn't find any point where this triviality is exploited. I mean, yes, this way a unit_t must a trivial type, but with this restriction I can't make an unit based on, for example,

Even without this restriction, a unit_t based on a trivial type remains trivial, so removing this constraint doesn't seems to have real downsides; it seems to me that default_constructible is sufficient for a type to be used with a NonLinearScale. Am I missing something? It would be possible to remove the constraint safely?

Thanks

nholthaus commented 2 years ago

I don't think this is an issue in 3.0.