I have a use-case that requires highly efficient bandwidth utilization over a narrow WAN connection, where communication is message-oriented. I have successfully used boost to gzip, zlib, and bzip2 my messages, and ran some numbers (bzip2 is best so far). However, in researching and profiling zlib's native API, I found I could improve efficiently by an additional 15% over bzip2 by using zlib's SetDictionary methods for deflate and inflate.

How would I go about extending boost:iostream's zlib_compressor and zlib_decompressor classes to utilized a predefined/static dictionary?  Or, is it best just to use zlib's API directly, and bypass boost for this specialized zlib compression case?