[Please do not mail me a copy of your followup]
boost-users@lists.boost.org spake the secret code
Bit of a basic question - I'd like to have some functions that work with files (using std::fstream) but can also handle boost::iostreams. Is there a data type I can use that can handle both? For example:
void writeSomeData(std::fstream out);
I can't pass a boost::iostream::stream to this function. What type can I use to achieve this?
Use the common base of std::basic_istream, std::basic_ostream, std::basic_iostream. I describe doing this in order to be able to unit test file handling code with a string stream in this blog post: How Do I Unit Test Something That Writes To A File? http://wp.me/pyVNs-V -- "The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/ Legalize Adulthood! http://legalizeadulthood.wordpress.com