-
Notifications
You must be signed in to change notification settings - Fork 105
Closed
Description
In C++, explicit
isn't explicit enough. If I have
std::vector<millimeters_t> vec;
vec.emplace_back(42.0);
that's not robust against changing it to std::vector<furlongs_t> vec;
; I'll wind up with 42.0 furlongs!
In my codebase I'm using a wrapper function, fromCount<Unit>(double) -> Unit
. I picked "count" to match std::chrono
's terminology. To be consistent with this library, I think it would be from_number<Unit>(double) -> Unit
.
I'm fine with a default c'tor and with a converting c'tor (mm -> inches), but how explicit that sort of thing is is an editorial choice :-)
JohelEGP and chiphogg
Metadata
Metadata
Assignees
Labels
No labels