Skip to content

Conversation

monarchdodra
Copy link
Collaborator

minPos didn't work with immutable elements anymore. Fixed and unittested.

Also: re-enforced constraints. Changed p (implies pointer) for 'v' (implies value).

Note that minCount remains broken. It is z bit harder to fix because minCount accepts simple input ranges (no save). The fix is more involved.

@@ -6125,7 +6126,7 @@ minCount(alias pred = "a < b", Range)(Range range)
++occurrences;
}
}
return tuple(p, occurrences);
return typeof(return)(v, occurrences);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was changed, because if ElementType!Range is immutable(T[]), then this will actually instantiate a Tuple!(immutable(T)[]), which is different from a Tuple!(immutable(T[])) == Tuple!(ElementType!Range).

alexrp added a commit that referenced this pull request Jan 14, 2013
Fixes issue 9299 - std.algorithm.minPos of const(int)[]
@alexrp alexrp merged commit bdc9599 into dlang:master Jan 14, 2013
@monarchdodra monarchdodra deleted the 9299 branch January 14, 2013 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants