Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-09-09 11:56:34


Robert Ramey wrote:
> And while you are thinking about this you might investigate the
> following:
>
> The serialization library uses temp files to test serialization. I
> would prefer to use string streams to avoid using temp files at all
> in most cases. However, it seems that string streams on some (or all)
> platforms don't support things like code_cvt facets

As I've mentioned before, stringstreams *never* perform code conversion. Of the
standard streams, *only* file streams use codecvts.

If you want something that behaves like a stringstream but performs code
conversion, you can use

    #include <boost/iostreams/code_converter.hpp>
    #include <boost/iostreams/stream.hpp>
    #include <libs/iostreams/example/container_device.hpp>

    namespace io = boost::iostreams;
    namespace ex = boost::iostreams::example;

    typedef
      io::code_converter<
        ex::container_source<std::wstring>
>
      string_source;

    typedef
      io::code_converter<
        ex::container_sink<std::wstring>
>
      string_sink;

    typedef io::stream<string_source> istringstream;
    typedef io::stream<string_sink> ostringstream;

> and who know what
> else so I don't feel comfortable using them to test. I guess this is
> really a research projects re string streams.

Jonathan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk