Add versioning support for RecyclableLongList
This commit is contained in:
1 parent
ed23fd7f69
commit
1e64c71af3
3 files changed
+142
-67
No files matched your search
@@ -10,19 +10,25 @@ namespace Recyclable.Collections
|
||||
public static void Sort<T>(this RecyclableLongList<T> list)
|
||||
{
|
||||
QuickSortExtensions<T>.QuickSort(list);
|
||||
#if WITH_VERSIONING
|
||||
list._version++;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void Sort<T>(this RecyclableLongList<T> list, Comparison<T> comparison)
|
||||
{
|
||||
QuickSortExtensions<T>.QuickSort(list, new ComparisonToComparerAdapter<T>(comparison), new SystemRandomNumberGenerator());
|
||||
#if WITH_VERSIONING
|
||||
list._version++;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void Sort<T>(this RecyclableLongList<T> list, IComparer<T>? comparer)
|
||||
{
|
||||
QuickSortExtensions<T>.QuickSort(list, comparer ?? Comparer<T>.Default, new SystemRandomNumberGenerator());
|
||||
#if WITH_VERSIONING
|
||||
list._version++;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void Sort<T>(this RecyclableLongList<T> list, long index, long count, IComparer<T>? comparer)
|
||||
@@ -33,7 +39,9 @@ namespace Recyclable.Collections
|
||||
}
|
||||
|
||||
QuickSortExtensions<T>.QuickSort(list, (int)index, (int)(index + count - 1), comparer ?? Comparer<T>.Default, new SystemRandomNumberGenerator());
|
||||
#if WITH_VERSIONING
|
||||
list._version++;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user