title: How can an NSIndexSet be a root object?
body: <p>Here is a typical code snippet when reordering a table with drag and drop.</p>
  
  <pre><code>- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard {
      NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rowIndexes];
      [pboard declareTypes:[NSArray arrayWithObject:MyDataType] owner:self];
      [pboard setData:data forType:MyDataType];
      sourceIndex = [rowIndexes firstIndex];
      return YES;
  }
  </code></pre>
  
  <p>Look at the line</p>
  
  <pre><code> NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rowIndexes];
  </code></pre>
  
  <p>How can rowIndexes be a root object?</p>
  
  <p>The docs say that The NSIndexSet class represents an immutable collection of unique unsigned integers.... You use index sets in your code to store indexes into some other data structure. For example, given an NSArray object, you could use an index set to identify a subset of objects in that array.</p>
  
  <p>It seems that the NSIndexSet is not a simply "an immutable collection of unique unsigned integers" but also a set of pointers that identify objects. It's very confusing, can anyone explain what's going on?</p>