In other words:
What to do in case of put() called from within write() fails?
I'm not certain, why the above is not sufficient. But here comes the code -- calling abort in case of error.
#include <boost/iostreams/filtering_stream.hpp>
struct filter
{   typedef char char_type;
    typedef boost::iostreams::multichar_output_filter_tag category;
    template<typename SINK>
    std::streamsize write(SINK &_rS, const char *const _p, const std::streamsize _iSize)
    {   for (std::size_t i = 0; i < _iSize; ++i)
            if (!boost::iostreams::put(_rS, _p[i]))
                abort();
        return _iSize;
    }
};
Aucun commentaire:
Enregistrer un commentaire