-
-
Notifications
You must be signed in to change notification settings - Fork 706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue 10777 - multiSort should return a SortedRange #4235
Conversation
|
94a1ac1 to
5c85223
Compare
| { | ||
| while (r.length > 1) | ||
| void multiSortImpl(funs...)(Range r) @safe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a static fun?
5c85223 to
d87abdb
Compare
|
thanks for your input @9il - addressed ;-) |
| @@ -844,7 +844,7 @@ private template validPredicates(E, less...) | |||
| } | |||
|
|
|||
| /** | |||
| $(D void multiSort(Range)(Range r) | |||
| $(D auto multiSort(Range)(Range r) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way how we could write SortedRange here?
The less fun is defined inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
fae4c69 to
adf529e
Compare
|
Another example of the new Travis linting at work :) There was also a small issue with autotester, that should be fixed now.
Please not that the difference to the stalled #4061 is that we just use a static, pred function which is passed to That being said 1) I would like to see MultiPred too and 2) this should be ready to go. The change for the user is that instead of void a SortedRange will be returned. If so, it will be added to the changelog once #4228 is there. Ping @MartinNowak. |
| @@ -856,12 +856,16 @@ and sorts elements that have the same $(D id) by $(D date) | |||
| descending. Such a call is equivalent to $(D sort!"a.id != b.id ? a.id | |||
| < b.id : a.date > b.date"(r)), but $(D multiSort) is faster because it | |||
| does fewer comparisons (in addition to being more convenient). | |||
|
|
|||
| Returns: The initial range wrapped as a $(D SortedRange) with its predicates. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about with its predicates converted to an equivalent single predicate.?
|
Changelog entry missing. |
8b11098 to
678385e
Compare
Added (could you please have a look at #4228)?
Have you looked at the implementation of All other comments were addressed - and I added a small fix ( |
678385e to
6b165d4
Compare
|
@MartinNowak I am too lazy to rebase all the time, so I removed the changelog entry again. Here is the message: edit: btw I thought that if it's linked to an issue, you can generate the log entry automatically? |
Yes, you'll get a Bugzilla fixed entry for references in a commit message. You can recognize that by the check mark in the dlang-bot comment. |
Ah great, that's as good as it can get. |
|
Auto-merge toggled on |
|
This pull request introduced a regression: |
As I now bumped for the second time into the problem of having a chainable
multiSort(=SortedRange), I quickly wrote my own solution. Afterwards I realized that #4061 is already open, there are a couple of minor differences, hereshrinkmethod is provided (but can be in the future)So in summary less (possibly controversial) changes.
As always, I am very happy about feedback.
@SzMK - let's join efforts to get this into Phobos?