IndexAllocatorOwnershipImage constructor

IndexAllocatorOwnershipImage({
  1. required int capacity,
  2. required Iterable<int> allocatedIndices,
})

Creates an allocator ownership image.

Implementation

IndexAllocatorOwnershipImage({
  required this.capacity,
  required Iterable<int> allocatedIndices,
}) : allocatedIndices = Set.unmodifiable(allocatedIndices) {
  if (capacity <= 0 ||
      this.allocatedIndices.any((index) => index < 0 || index >= capacity)) {
    throw ArgumentError(
        'Allocator capacity must be positive and contain every index.');
  }
}