I perfectly understand that because of performance reasons the operator*
in std::optional
does not make any checks for the actual existence of a contained value. However, in debug mode performance considerations should not matter and it would make a lot of sense to me that some kind of assertion should be made while in debug mode.
Visual studio doesn't seem to have such an assertion (though I am not sure of other compilers).
My question is: Is there any fundamental reason why the compiler would NOT make such an assertion on debug mode or is it just a missing feature?