[Issue 19637] Add a pre-condition to "in" and contains()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 31 23:29:26 UTC 2019


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

Alex <sascha.orlov at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sascha.orlov at gmail.com

--- Comment #1 from Alex <sascha.orlov at gmail.com> ---
Arent't "in" and contains already properties of a SortedRange object? How comes
that your SortedRange is not sorted? 

According to 
https://dlang.org/phobos/std_algorithm_sorting.html#.isSorted
the check for sortedness would require O(r.length) evaluations. I don't think,
you really want to have this check run every evaluation of "in" or contains, do
you?

--


More information about the Digitalmars-d-bugs mailing list