$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [outcome] Ternary logic -- need an example
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2017-05-19 20:41:18
Le 18/05/2017 à 16:50, Peter Dimov via Boost a écrit :
> Niall Douglas wrote:
>> I did consider returning optionals which might be empty instead of
>> throwing an exception.
>
> That's not what I was saying. I was saying that for
> result<optional<T>>, if you return by reference, you have to store an
> optional<T> object inside your result. But if you return by value, you
> don't have to store an optional and you can reuse your existing tag
> instead of adding the extra bool flag. That is, use variant<T, none,
> error_code> instead of variant<optional<T>, error_code>.
>
>> > Also applies to other possible combinations such as
>> expected<expected<T, > E1>, E2>, ...
>
> Similarly, expected<expected<T, E1>, E2> can use a single variant<T,
> E1, E2> for storage, if it can return by value. Return by reference
> requires it to have an actual expected<T, E1> object to which to bind
> the returned reference.
Do you believe that these function should return by value in the general
case or just for the nested expected?
Best,
Vicente