Boost logo

Boost :

From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2024-12-16 11:02:24


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.

> I presume naming is what most people will have strong feeling about.
> I personally prefer ofind/oat since I love short names, Barry suggested
> different names in his blog
> <https://brevzin.github.io/c++/2023/05/23/map-api/>, e.g. try_at.
>

"Oat" seems particularly funny.

>
> 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.
https://www.boost.org/doc/libs/1_87_0/libs/optional/doc/html/boost_optional/quick_overview/monadic_interface.html

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.

Regards,
&rzej;

>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk