|
Boost Users : |
Subject: Re: [Boost-users] [Serialization]Substituting std::istringstream fortext_iarchive?
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-05-05 12:33:26
Laszlo Orban wrote:
> However this being a frequently used code, we are wondering if there
> is any better (more time effective) solution or workaround. (Note: we
> tried using the boost/format/alt_sstream, but we couldn't get it to
> work.) Or maybe we can substitute text_iarchive with something else
> that doesnt require an std::stream?
>
Note that the serialization library text_iarchive doesn't require a
stream. It required something that "looks like a stream". So you
would well substitute you're "own thing". Un fortunately, this
would require re-impleming the to/from string operators which
would be a pain.
Given that this is machine to machine communication, You would
find it a lot faster to use binary_?archive which doesn't use the
stream functionality. (The binariy archive constructor can take
a stream as an argument, but all that does is extract the
pointer to the stream_buf object and use that directly.) If you
need to communicate accross machine architectures, you
can use portable_binary_?archive which is included in the
package as an example.
If your analysis is correct and there is some shared state
accross streams in your implementation, I would consider
that implementation severly broken. This seems unlikely
to me so you might want to invest some more time in tracking
down the exact problem.
Robert Ramey
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net