Date: Fri, 19 Jan 2024 17:08:18 -0500
On Fri, Jan 19, 2024 at 4:45 PM Jan Schultke via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> I generally support the idea of *some* customization point, but there
> needs to be a critical examination of all available options:
> 1. relying on the implementation to handle std::ranges::contains
> specially for standard library containers
> 2. adding this new std::contains customization point
> 3. adding a contains() member function to all containers
> 4. simply burdening the user with making their own customization point
>
> It's not obvious whether your chosen direction is best.
>
> > bool containsOne = std::contains(numbers, {1, 4, 5}); // true
>
> I *strongly* oppose this design. If you want this, you should make two
> separate functions:
> - std::contains_all
> - std::contains_any
Looking at the inspiration (`basic_string::contains`), I believe the
idea is that it searches for those items in sequence and only returns
true if that sequence is found in the given range. So the "any" vs.
"all" would represent different functionality.
<std-proposals_at_[hidden]> wrote:
>
> I generally support the idea of *some* customization point, but there
> needs to be a critical examination of all available options:
> 1. relying on the implementation to handle std::ranges::contains
> specially for standard library containers
> 2. adding this new std::contains customization point
> 3. adding a contains() member function to all containers
> 4. simply burdening the user with making their own customization point
>
> It's not obvious whether your chosen direction is best.
>
> > bool containsOne = std::contains(numbers, {1, 4, 5}); // true
>
> I *strongly* oppose this design. If you want this, you should make two
> separate functions:
> - std::contains_all
> - std::contains_any
Looking at the inspiration (`basic_string::contains`), I believe the
idea is that it searches for those items in sequence and only returns
true if that sequence is found in the given range. So the "any" vs.
"all" would represent different functionality.
Received on 2024-01-19 22:08:27