Description
Hi, I really appreciate all your work on this proposal, I really think it would be great if std::expected
made it into the standard.
I have one "feature request": In the current proposal you say:
This proposal doesn't include expected references as optional [C++17] doesn't include references either. We need a future proposal.
I don't think this is a meaningful comparison. optional<T&>
adds no extra functionality compared to T*
, so I assume the committee probably thought it was a waste of time. On the other hand, expected<T&, Error>
clearly adds additional functionality compared to T*
.
In my company we have tried to take an approach similar to std::expected
, packaging an optional
together with an error, but it didn't get received well because of the lack of references. Nobody wants to use std::expected<std::reference_wrapper<T>, Error>
as the return type to a function in an API.