Skip to content

Commit

Permalink
Pass delegate
Browse files Browse the repository at this point in the history
  • Loading branch information
wrenge authored and ikpil committed Dec 11, 2024
1 parent 1a7fcb3 commit 5c4c774
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/DotRecast.Core/Collections/RcSortedQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public class RcSortedQueue<T>
{
private bool _dirty;
private readonly List<T> _items;
private readonly Comparer<T> _comparer;
private readonly Comparison<T> _comparison;

public RcSortedQueue(Comparison<T> comp)
{
_items = new List<T>();
_comparer = Comparer<T>.Create((x, y) => comp.Invoke(x, y) * -1);
_comparison = (x, y) => comp(x, y) * -1;
}

public int Count()
Expand All @@ -55,7 +55,7 @@ private void Balance()
{
if (_dirty)
{
_items.Sort(_comparer); // reverse
_items.Sort(_comparison); // reverse
_dirty = false;
}
}
Expand Down

0 comments on commit 5c4c774

Please sign in to comment.