Expected<T>::emplaceInto() takes as an out parameter any
Optional<OtherT>, with OtherT constructible from T&&. It either
calls Optional<OtherT>::emplace() with the stored value, or calls
Optional<OtherT>::reset() if none, before returning takeError().
emplaceInto() is similar to Expected<T>::moveInto() / https://reviews.llvm.org/D112278, but works with an
Optional that contains a construct-only type that T can be moved into.
Optional<ConstructOnly> P; if (Error E = makeConstructOnly().emplaceInto(P)) return E;
I'm not sure this is really useful enough -- construct-only types are a
real thing, but it's not often possible to move-construct them. It's
unlikely that an Expected would contain one. Perhaps this is too
specific a use case?
Also, would this be better as a free function? (It probably doesn't make
sense to add overloads to Expected<T> for arbitrary box types... but
as a free function you could easily extend without modifying Expected.)