Listing 19 Adds a helper class for operator[] to the standard C++ bitstring class

// bitstr.h:   The C++ bitstring class

class bitstring
   // Helper class for operator[]
   class bitref
      friend class bitstring;

      bitstring &bs;
      size_t bit;
      bitref(bitstring& bs_, size_t bit_);

      int operator=(int);
      operator int();

   // Subscripting
   bitref operator[](size_t pos);

   // The definition of bitstring continues here...
   // (See "Bit Manipulation in C++, Part 1", CUJ, Dec. 1993)
/* End of File */