|
|
|
|
|
by simonask
403 days ago
|
|
I mean, the default behavior of single-argument constructors in C++ is implicit conversion. You have to opt into explicit conversions using the `explicit` keyword on constructors and assignment operators. Then you have all the shenanigans around placement-new and vtables. If it isn't downright weak, it's also not particularly strong. |
|
OTOH placement-new is pretty much impossible to use by accident. If used intentionally, I don't see it as being any different from an explicit cast - again, you get what you signed up for.
Interestingly in some ways C++ is arguably more typesafe than languages like Java or C#, given how it handles dynamic type of object during construction & destruction...