private static void DistinctSkip(ref HashSetContext <T, C> context, out Option <T> next) { context.bd.DetectBacktrack(); if (context.needsMove) { context.chained.skip(ref context.chained.context, out context.chained.current); } else { context.needsMove = true; } while (context.chained.current.isSome && !context.hashSet.value.Add(context.chained.current.value)) { context.chained.skip(ref context.chained.context, out context.chained.current); } if (!context.chained.current.isSome) { context.bd.Release(); if (context.release) { context.hashSet.Dispose(); } } next = context.chained.current; }
private static void IntersectRemove(ref HashSetContext <T, C> context, out Option <T> next) { context.bd.DetectBacktrack(); context.needsMove = false; context.chained.remove(ref context.chained.context, out context.chained.current); IntersectSkip(ref context, out next); }
private static void Dispose(ref HashSetContext <T, C> context, out Option <T> next) { next = new Option <T>(); context.bd.Release(); context.chained.dispose(ref context.chained.context, out context.chained.current); if (context.release) { context.hashSet.Dispose(); } }