/** 
   * Move the bits set in acc to the places specified by mapping.
   */
  void move_acceptance_bits(BitSet& acc,
			    std::vector<unsigned int> mapping) {
    int i=acc.nextSetBit(0);
    while (i!=-1) {
      unsigned int j=mapping[i];
      // :: j is always <= i
      if (j>(unsigned int)i) {
	THROW_EXCEPTION(Exception, "Wrong mapping in move_acceptance_bits");
      }

      if (((unsigned int)i) == j) {
	// do nothing
      } else {
	// move bit from i->j
	acc.set(j);
	acc.clear(i);
      }
      i=acc.nextSetBit(i+1);
    }
  }
 bool skipTo(int32_t target) {
     _doc = bits->nextSetBit(target);
     return _doc >= 0;
 }
 bool next() {
     _doc = bits->nextSetBit(_doc+1);
     return _doc >= 0;
 }