Boost logo

Boost :

From: Jerry Schwarz (jerry_at_[hidden])
Date: 2007-05-31 02:24:09

You have followed the lead of iostream by using multiple inheritance
to derive binary_iostream from binary_istream and binary_ostream. I
did this originally as a way to make expressions like

     cout << x
     cin >> x

compile time errors. It succeeded in that aim, but it has real
drawbacks. For example it seems that you really shouldn't need
ifstream, ofstream and iofstream. One "fstream" ought to suffice.

I believe that a better approach in the current C++ language would be
to use template programming. Concretely, binary_stream would be a

    class binary_stream<bool in, bool out> { ... }

template specialization would then supply concrete classes so that if
in is true you have the input operators and if out is true you have
the output operators.

On May 23, 2007, at 3:45 AM, Ares Lagae wrote:

> I have developed a small library for binary I/O, called
> binary_iostreams,
> and I am using it in several of my own projects. I was wondering if
> there
> is interest for such a binary_iostreams library?
> The binary_iostreams is a small library, very similar to the iostreams
> library. Compared to iostreams, the unformatted I/O operators
> remain, and
> the formatted I/O operators now do binary I/O. This makes the
> binary_iostreams library easy to use for anyone acquainted with the
> iostreams library. The binary_iostreams library allows to set the
> endianness of the output stream. Together with <cstdint>, this
> allows for
> portable binary I/O, although binary_iostreams does not claim to be
> a full
> blown serialization library.
> Direct link to a motivating example:
> The library:
> binary_iostreams-0.1.tar.gz
> The documentation:
> Best regards,
> --
> Ares Lagae
> Computer Graphics Research Group, Katholieke Universiteit Leuven
> _______________________________________________
> Unsubscribe & other changes:
> listinfo.cgi/boost

Boost list run by bdawes at, gregod at, cpdaniel at, john at