Missing documentation about missing native based constructors
Closed this issue · 1 comments
Hi,
I would be able to explain my collegues, why something like au::QuantityD<au::Seconds> a{1};
is not allowed like in nholtshaus.
My guess is, that you can always alias a type like using Timeout = au::QuantityD<au::Milli<au::Seconds>>;
and then do false assumptions about the magnitude (i.e., seconds vs. milliseconds).
But maybe the reason is much deeper and I would like to read this in the documentation.
You're right --- this is a hole in our documentation. We'll need to create an official explanation for this design decision.
You're also right about the reason: we want to be able to support aliases. That was the original motivation. However, since then, others have pointed out additional use cases for this: see mpusz/mp-units#434. Providing an explicit constructor would also create vulnerabilities in emplace_back()
use cases.
I hope these resources are helpful for your colleagues in the meantime, before we add our own official docs for this.