Your best bet is probably to make both a new stream class and a stream buffer class. Use the custom stream class to overload the output operators to put a single bit in the custom stream buffer.
The reason is that C++ doesn't support smaller entities than a single byte (char
). Even the bool
type is not a single bit, as it has to be addressable.