From: John Maddock (jm_at_[hidden])
Date: 2003-06-07 05:56:24
> Actually, the problem I have is that GCC extended the copying ban to
> std::basic_streambuf<>, even though DR 50 only mentions std::ios_base.
> I know that copying stream bases or stream buffers are probably bad
> ideas, but I didn't feel comfortable leaving copy semantics out of my
> subclass's description, especially since I knew the default copy
> semantics would be wrong. Should I just take the copying code out and
> hope that no one will try copying? (Remember that copying can be
> attempted, with unknown results, on compilers without DR 50.) Should I
> explicitly ban copying in my subclass?
Personally I would say "yes", is there a good reason for copying stream
buffers (I can't think of one)? Looks like a grey area of the standard to
me, I don't think that basic_streambuf was supposed to be copyable, but you
never know, I'll check on the std-lib reflector.
> Even if I add explicit non-copying, that is only necessary only if
> stream-buffer copying wasn't already banned in std::basic_streambuf. I
> would still need a macro to know when to apply my own copying ban.
> (Since GCC added the ban on stream-buffer copying on its own, it's not
> covered by DR 50. So I can't expect every compiler to eventually do
> that change too.)
If you add a private copy constructor then that will always work, no matter
what the base class does.