Date: Tue, 15 Nov 2022 03:25:29 +0100
Hi,
Il 13/11/22 14:27, Roberto R via Std-Proposals ha scritto:
> In attachment you can find a draft proposal of a function std::value_or,
> similar to std::optional::value_or.
>
> In previous threads I called it coalesce.
>
> Can you please tell me your opinion?
>
I'm very confused by the idea that one allows both "plain values" as
well as callables that return values to check.
If I call value_or with a bunch of function pointers, trying to find the
first non-null pointer (or return the given default), is it going to try
to *call* these pointers because they're callables?
To me, the "mere" selection facility vs. try to invoke and use the
return values ought to be spelled _very_ differently. For instance, for
optional there's value_or (that takes a value) and the proposed
value_or_else that takes a callable.
My 2 c,
Il 13/11/22 14:27, Roberto R via Std-Proposals ha scritto:
> In attachment you can find a draft proposal of a function std::value_or,
> similar to std::optional::value_or.
>
> In previous threads I called it coalesce.
>
> Can you please tell me your opinion?
>
I'm very confused by the idea that one allows both "plain values" as
well as callables that return values to check.
If I call value_or with a bunch of function pointers, trying to find the
first non-null pointer (or return the given default), is it going to try
to *call* these pointers because they're callables?
To me, the "mere" selection facility vs. try to invoke and use the
return values ought to be spelled _very_ differently. For instance, for
optional there's value_or (that takes a value) and the proposed
value_or_else that takes a callable.
My 2 c,
-- Giuseppe D'Angelo
Received on 2022-11-15 02:25:33