At present, the Object has an interface that returns the type std::optional<T*>. This return type is troublesome for the user. Is the returned pointer pointing to a valid address? In fact, the pointer here is always valid. This would not be a problem if the return type was std::optional<std::reference_wrapper<T>>.
At present, the Object has an interface that returns the type std::optional<T*>. This return type is troublesome for the user. Is the returned pointer pointing to a valid address? In fact, the pointer here is always valid. This would not be a problem if the return type was
std::optional<std::reference_wrapper<T>>
.