Skip to content
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

Let parametrize IComparer via constructors #26

Closed
mat-pielat opened this issue May 9, 2017 · 3 comments
Closed

Let parametrize IComparer via constructors #26

mat-pielat opened this issue May 9, 2017 · 3 comments

Comments

@mat-pielat
Copy link

A simple addition which lets people prioritize maximum elements over minimum ones. It also nicely decouples the default comparer of the priority class from the one used in the queue.

@BlueRaja
Copy link
Owner

BlueRaja commented May 9, 2017

I tested this before and it resulted in performance degradation (yes, I expected the JIT to optimize it away also, but apparently it does not do so completely).

There'd be no way to do this in only SimplePriorityQueue without rewriting a large portion of it (since it relies on FastPriorityQueue), so I have to deny this request, sorry.

@BlueRaja BlueRaja closed this as completed May 9, 2017
@BlueRaja
Copy link
Owner

BlueRaja commented May 9, 2017

Ah, sorry I was misremembering! I do use IComparer for SimplePriorityQueue, so this would be possible. Hmm.

@BlueRaja BlueRaja reopened this May 9, 2017
@BlueRaja
Copy link
Owner

Completed in v4.1.1
SimplePriorityQueue can now take a IComparer<TPriority> or Comparison<TPriority> in its constructor.

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

No branches or pull requests

2 participants