std::basic_string<bool>This type works just like the std::string class you have used before (including working with standard library iterators and algorithms).
/dept/cs/cs230/public/projects/project2
The bit_unpacker class provides a function that returns individual bits from a stream:
bool read(std::istream & in);The bit_packer class provides two functions, one that writes a string of bits to a stream, and a second that should be used after you have processed the last bit to ensure all bits are actually written (this is necessary since the system can only write bytes, or groups of 8 bits, at a time):
void write(std::ostream &, const std::basic_string<bool> &); void flush(std::ostream &);
Do not mix normal I/O and bit I/O on the same stream!
std::istream & in; in.clear(); in.seekg(0);
If you are comfortable with STL and would like to try something more advanced, investigate using the priority_queue class in the standard library for this task. You will need to use a function object to tell it how to compare the weight of two binary trees. Use of this class is strictly optional; if you have trouble getting it to work, just use a list or vector.
c:\program files\devstudio\vc\include\iosfwd(83) : warning C4804: '<' : unsafe use of type 'bool' in operation c:\program files\devstudio\vc\include\iosfwd(127) : warning C4305: 'return' : truncation from 'const int' to 'bool'These are in the standard library and can be safely ignored.