mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 22:50:38 +03:00
Do reflexivity check in assert mode if predicate is claimed to be equivalence relation.
This commit is contained in:
parent
ab72e3cf51
commit
b7c3816fdb
1 changed files with 7 additions and 0 deletions
|
@ -4663,7 +4663,14 @@ private struct GroupByImpl(alias pred, IsEquivRelation isEquivRelation, Range)
|
|||
{
|
||||
r = _r;
|
||||
if (!empty)
|
||||
{
|
||||
// Check reflexivity if predicate is claimed to be an equivalence
|
||||
// relation.
|
||||
assert(!isEquivRelation || pred(r.front, r.front),
|
||||
"predicate " ~ pred.stringof ~ " is claimed to be "~
|
||||
"equivalence relation yet isn't reflexive");
|
||||
savePrev();
|
||||
}
|
||||
}
|
||||
@property bool empty() { return r.empty; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue