Closed kkaefer closed 8 years ago
👍
The issue with this is that value
will still be constructible or assignable with nullptr
, but instead of being set to the null alternative as you might expect (and as happens now), it will segfault at runtime.
It segfaults because the std::string constructor is invoked with the nullptr.
My bad -- it does not segfault. It constructs a value
where bool
is the stored type and false
is its value.
I would feel more comfortable with this change if we could fix https://github.com/mapbox/variant/issues/100, such that an ambiguous assignment from nullptr
was an error.
I think #40 avoids those potential issues!
Instead of using
std::nullptr_t
, we should use an explicit null type (like astruct null_value {};
).std::string
has an overload that also acceptsstd::nullptr_t
.See https://github.com/mapbox/variant/issues/100