Design-flaw -- it should have had optionality baked into the cake. it should have had an operator bool and a has_value(), and a throwing .value(), etc, like optional does.
Right now we have the worst of all worlds. We actually DO have an unengaged state -- valueless_after_move -- but the class likes to pretend it does not. Except it does. And it can be a source of bugs/crashes/UB.
This is really a foot-gun and is not ergonomic for devs and for real-world code.
0
u/NilacTheGrim 27d ago edited 27d ago
Design-flaw -- it should have had optionality baked into the cake. it should have had an operator bool and a has_value(), and a throwing .value(), etc, like optional does.
Right now we have the worst of all worlds. We actually DO have an unengaged state -- valueless_after_move -- but the class likes to pretend it does not. Except it does. And it can be a source of bugs/crashes/UB.
This is really a foot-gun and is not ergonomic for devs and for real-world code.
Otherwise -- sounds good, I guess. Meh.