Boost logo

Boost :

From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2024-12-17 14:08:17


On Mon, Dec 16, 2024 at 10:46 PM Ivan Matek <libbooze_at_[hidden]> wrote:

> On Mon, Dec 16, 2024 at 6:24 PM Vinnie Falco <vinnie.falco_at_[hidden]>
> wrote:
>
>> Can this be implemented as a free function over the public API of
>> unordered containers? In other words, this signature:
>>
> Yes, but it is not like Barry or other people
> <https://www.youtube.com/watch?feature=shared&t=150&v=kye4aD-KvTU>
> wanting member functions do not know this.
>

It seems there are two choices here:

1. Add a member function to uncountably many existing and future unordered
containers by adding a member function

2. Write a single, separate free function template which works for all
existing and future unordered containers

The member function requires selecting an optional type and including its
header, while the free function approach can scale to different optional
types (one per free function).

Please explain why we should prefer 1 instead of 2.

Thanks


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