[Issue 15230] New: Inconsistent std.range.SortedRange predicate checks
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Oct 21 04:22:00 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=15230
Issue ID: 15230
Summary: Inconsistent std.range.SortedRange predicate checks
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: john.loughran.colvin at gmail.com
SortedRange doesn't check that it's predicate actually works unless you use one
of lowerbound, upperBound etc. or you compile with -debug, in which case things
will fail internally to std.functional.binaryFun due to the usage of the
predicate in dbgVerifySorted.
Note that people could be signalling sorted-ness using SortedRange, not
considering they have invalid predicates, e.g.
struct S { int a,b; }
void foo(R)(R r)
if(isInstanceOf!(SortedRange, P) && is(ElementType!R == S))
{
//assumes some idea of sorted-ness
}
only(S(0,1), S(0,4), S(3,4), S(4,4)).assumeSorted.foo();
but I guess it's OK to break that because it was technically incorrect, if
rather opaquely so....
--
More information about the Digitalmars-d-bugs
mailing list