File tree Expand file tree Collapse file tree
Bearded.Utilities/Collections Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
2+ using System . Collections ;
23using System . Collections . Generic ;
34using System . Linq ;
45
@@ -9,7 +10,9 @@ namespace Bearded.Utilities.Collections
910 /// </summary>
1011 /// <typeparam name="TPriority"></typeparam>
1112 /// <typeparam name="TValue"></typeparam>
12- public class StaticPriorityQueue < TPriority , TValue > where TPriority : IComparable < TPriority >
13+ public class StaticPriorityQueue < TPriority , TValue >
14+ : IEnumerable < KeyValuePair < TPriority , TValue > >
15+ where TPriority : IComparable < TPriority >
1316 {
1417 /// <summary>
1518 /// Array-representation of the entire heap.
@@ -203,5 +206,15 @@ private static int getRightChild(int i)
203206 return 2 * i + 2 ;
204207 }
205208 #endregion
209+
210+ public IEnumerator < KeyValuePair < TPriority , TValue > > GetEnumerator ( )
211+ {
212+ for ( var i = 0 ; i < Count ; i ++ )
213+ {
214+ yield return data [ i ] ;
215+ }
216+ }
217+
218+ IEnumerator IEnumerable . GetEnumerator ( ) => GetEnumerator ( ) ;
206219 }
207220}
You can’t perform that action at this time.
0 commit comments