|
Boost : |
From: Ivan Matek (libbooze_at_[hidden])
Date: 2024-12-16 11:37:06
On Mon, Dec 16, 2024 at 12:02â¯PM Andrzej Krzemienski <akrzemi1_at_[hidden]>
wrote:
>
>
> pon., 16 gru 2024 o 11:36 Ivan Matek via Boost <boost_at_[hidden]>
> napisaÅ(a):
>
>> Hi everybody,
>>
>> I presume somebody thought of this before but for some reason it never
>> happened, but just in case it was never discussed I wonder if people here
>> believe adding an nicer version of find(with different name obviously) to
>> associative containers in boost would be beneficial?
>>
>> Since boost::optional allows references this would work.
>>
>
> It does, but conceptually optional<T&> as a return type is not much
> different than T* return type.
>
Well I do not think so, as optional avoids using raw pointers(I understand
some do not care about this fact, but I think many people do), and as
mentioned before people like to chain
<https://devblogs.microsoft.com/cppblog/cpp23s-optional-and-expected/>
operations on optional. I could type here few more sentences, but I think
Barry did it better than I ever could.
https://brevzin.github.io/c++/2021/12/13/optional-ref-ptr/
> *All the operations in the orange circle are highly irrelevant to this
> problem and would be completely wrong to use. They are bugs waiting to
> happen.*
>
>
>> boost::optional did not get all the updates C++23 std::optional got, e.g.
>> transform that make this usage compose nicely, but those could be added to
>> boost::optional.
>>
>
> Note that boost::optional has had the "monadic interface" for a while.
> It just uses a different name (map) as at the time we were adding it, a
> monadic interface in std::optional was not a thing.
>
my bad, sorry, I just googled and ended up here, did not find it:
https://www.boost.org/doc/libs/1_87_0/libs/optional/doc/html/optional/reference/header__boost_optional_optional_hpp_.html
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk