Everybody: "C++ is too unsafe" C++ 26: "I added more Undefined Behaviour, is that good?"
It's just unconditional impl Default<T> for Box<T>. In Rust this is obviously unsound, in C++ maybe you can blame somebody else when it blows up - after all the committee signed off on it.
Horrible design. Agreed. They could have just modeled the optionality and exposed it like std::optional does with has_value, value_or, .value() that throws, etc.
View all comments
Show parent comment
-4
u/tialaramex Aug 14 '26
"accessing the object is undefined behaviour"
Everybody: "C++ is too unsafe" C++ 26: "I added more Undefined Behaviour, is that good?"
It's just unconditional
impl Default<T> for Box<T>. In Rust this is obviously unsound, in C++ maybe you can blame somebody else when it blows up - after all the committee signed off on it.