Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-07-26 05:39:38

On Sat, 26 Jul 2003 01:08:00 -0400, "Eric Friedman"
<ebf_at_[hidden]> wrote:

>In adding output streaming support for variant, I've realized the
>standard library packaged with gcc 2.9.7 and below does not support the
>templated stream classes. I've also realized that Boost.Tuple features a
>workaround addressing this same problem, with a comment to add a defect
>macro to boost/config.hpp in the future.

The test in Boost.Tuple however is totally wrong (it just tests for
the compiler, while it should test for the library - also IIRC the
library that ships with gcc 2.95 doesn't have the templated iostreams

I had this problem with dynamic_bitset and, after discussing it with
Phil Edwards (who is one of the maintainers of libstdc++), I came up
with the macro that is currently in

Basically I just wanted to support pre-3.0 versions of libstdc++, at
least the ones that are still in wide usage, and I don't know whether
that macro actually detects all of them or not; but it worked on the
versions I tried it on and there appears to be nothing better to test
for (libstdc++ 3 identifies itself with a suitable macro, __GLIBCPP__,
but previous versions don't).

Of course I agree that having a single macro in a single place is
good, but your solution seems overkilling to me: consider that, though
there are cases where you are able, with a couple of macros, to write
an inserter or an extractor that works with both old and new
iostreams, there are many other cases where the two versions are quite
different; take a look, for instance, at the new dynamic_bitset
extractor: it is totally different from a (yet to come) old-iostreams
version because it uses the stream buffer directly and because it
takes into account throwing for eofbit, failbit, etc. In such cases I
don't claim that boost developers always write an old-iostream version
too, so your macros would probably be far less used than it might
appear at first sight)


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