
15 May
2017
15 May
'17
11:13 p.m.
Gavin Lambert wrote:
I don't know if it would be worthwhile to try to optimise storage for that case. [result<optional<T>>]
An interesting point, because this is an argument in favor of returning by value from result<>::value() - I can synthesize an optional<T> on demand instead of storing one. (Return by reference mandates having an optional<> object stored.) Also applies to other possible combinations such as expected<expected<T, E1>, E2>, outcome<expected<T, E>>, and so on that can all in principle be flattened into a single variant under the hood.