[Issue 17679] SortedRange.contains should be deprecated in favor of the generic canFind

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 27 12:12:25 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=17679

Nick Treleaven <nick at geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |nick at geany.org
         Resolution|---                         |INVALID

--- Comment #1 from Nick Treleaven <nick at geany.org> ---
Closing as having both is intentional. Generic code may need `contains` to
guarantee complexity. The alternative:

> The Achilles's heel of checking for SortedRange is that not only sorted ranges have fast contains - a variety of hashed containers come to mind. Any range with fast searching should implement contains.

Discussion starts here:
https://github.com/dlang/phobos/pull/5651#issuecomment-317558570

--


More information about the Digitalmars-d-bugs mailing list