Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rough draft of implementing comparators. WIP, just looking for general design discussion. Do not merge.
Notes:
Ord
is defined? Realistically I'd like to migrate a lot of std away from requiringOrd
, and instead requiring aComparator
(the former being trivial to move to the latter withNaturalOrdering
andRevOrdering
).default_type_params
, but it never seemed to do anything meaningful.Fn
, but as far as I can tell, the type they'd have to impl would be beFn<(&T, &T), Ordering>
, but the references need to have lifetimes, and I see no sane way to do that generically? Just feeding in 'a,'b everywhere certainly didn't work.min_heap
andmax_heap
as simply public functions, because they didn't make a lot of sense as static methods.max_heap
the default behaviour to match previous behaviour, but now that they're trivially interchangeable, I recommendmin_heap
be the default, since that matches sorting more closely.lt
method), but again I'd like to refactor them out into a separate module and use them more everywhere. In that context they should return a properOrd
. Might be some overhead right now from doingcmp(x,y) == Greater
, rather thangt(x, y)
.lt
/gt
/eq
/neq
automatically; desirable?Extend
is demanding that the comparator beDefault
, even though I see no reason for this to be the case.tests.test_iterator
from_vec_natural
if desired.