mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 15:40:36 +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,8 +4663,15 @@ private struct GroupByImpl(alias pred, IsEquivRelation isEquivRelation, Range)
|
||||||
{
|
{
|
||||||
r = _r;
|
r = _r;
|
||||||
if (!empty)
|
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();
|
savePrev();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@property bool empty() { return r.empty; }
|
@property bool empty() { return r.empty; }
|
||||||
|
|
||||||
@property auto front()
|
@property auto front()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue