-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
I am evaluating which strong type library we could use in your environment.
I really like the simplistic of your implementation. But one thing botters me. Maybe you can help me, if I oversee a function or oversee the concrete concept here.
Is the ADL function value_of the only way to get the underlying value? If so, consider following example:
using my_strong_type = strong::type<int, struct foo>;
my_strong_type value{10};
int i = value_of(value);Everything looks fine, but if someone later changes the underlying value to double, the narrowing is maybe only visible through compiler warnings.
If I could explicit (like a static_cast in other strong_type implementations) define the target type, the compiler wouldn't even compile this code.
using my_strong_type = strong::type<double, struct foo>;
my_strong_type value{10};
int i = value_of<int>(value); // Whoops!Metadata
Metadata
Assignees
Labels
No labels