Looking at the implementations of operator* in std::optional I wondered if it would be helpful if they had debug asserts which check that has_value() is true to catch optionals being dereferenced when they shouldn't be. Would this make any sense to add or are there reasons not to have something like that?
Looking at the implementations of
operator*instd::optionalI wondered if it would be helpful if they had debug asserts which check thathas_value()is true to catchoptionals being dereferenced when they shouldn't be. Would this make any sense to add or are there reasons not to have something like that?