While implementing and using my interval map my interval map I needed to return an optional reference in one of its accessor methods, namely operator[](Key)
. The idea is to get a reference to a stored value or nothing. Thus I did it there with an std::optional<std::reference_wrapper<const T>>
. Following this pattern of optional refs led to complications when I tried accessing an std::optional<std::reference_wrapper<T>>
at some other point of time. I couldn't write something like this
While implementing and using my interval map I needed to return an optional reference in one of its accessor methods, namely operator[](Key)
. The idea is to get a reference to a stored value or nothing. Thus I did it there with an std::optional<std::reference_wrapper<const T>>
. Following this pattern of optional refs led to complications when I tried accessing an std::optional<std::reference_wrapper<T>>
at some other point of time. I couldn't write something like this
While implementing and using my interval map I needed to return an optional reference in one of its accessor methods, namely operator[](Key)
. The idea is to get a reference to a stored value or nothing. Thus I did it there with an std::optional<std::reference_wrapper<const T>>
. Following this pattern of optional refs led to complications when I tried accessing an std::optional<std::reference_wrapper<T>>
at some other point of time. I couldn't write something like this