LWG-4015 LWG-3973 broke `const` overloads of `std::optional` monadic operations
LWG-4015 LWG-3973 broke const overloads of std::optional monadic operations
It looks like this may be unobservable for us right now, especially because in #4158 I noted that the earlier LWG-3973 was "Implemented without comments". However, I do observe variation between our current implementation and LWG-4015's resolution. For example, our converting move constructor says _STD move(*_Right) (i.e. deref optional, then move):
https://github.com/microsoft/STL/blob/ab6dec6d85c90b272d219ba60da4478b169b72b4/stl/inc/optional#L292-L296
But LWG-4015 specifies std::move(rhs).operator*(), i.e. move optional, then deref.
I'll note this issue in #5607 tracking optional<T&>, but I think we can clean up divergence here before implementing that feature.
Hi, I'd like to work on this issue.
Just do it. You can test this with ADL-found operator* like, e.g.
namespace bad {
template<class T>
void operator*(const optional<T>&) = delete;
struct S { /* ... */ };
} // namespace bad
// testing optional<bad::S>
Hi @khaledS20, do you still plan to address this issue in the near future? It has been three weeks since the last activity. If not, I will handle the issue the following week.