Hello everybody,

I want a stream view of a dynamically allocated BYTE* buffer I have at hand. At first I thought boost::iostreams::basic_array< BYTE > would do the job since they're the closest thing I found in Boost IOStreams library, but as it turns out I was wrong, since the code fails to compile with dynamically allocated buffers.

typedef boost::iostreams::basic_array< unsigned char > MemoryDevice;
typedef boost::iostreams::stream< MemoryDevice > MemoryStream;

BYTE* mem = new BYTE[ 1000 ];
MemoryDevice memoryDevice( mem );
MemoryStream memoryStream( memoryDevice );

I was wondering if there are any available streams that are capable of providing stream-like behavior to such buffers, or should I write a device to handle them?

Any help is greatly appreciated.