Why did you make streambufs noncopyable?
Daryle Walker
dwalker07@snet.net
Wed Jun 4 04:15:00 GMT 2003
One of my projects has me writing a class (template) that derives from
std::basic_streambuf. I added a copy constructor to my class that
calls the base-class copy constructor, then copies my extra data. As
soon as I wrote an unit test that called the copy constructor, your
compiler complained that streambufs were noncopyable.
I'm using an eMac running Mac OS X 10.2.6 with the July 2002 developer
tools (actually the August 2002 tools with the October 2002
anti-update) installed. It runs "gcc (GCC) 3.1 20020420 (prerelease)",
which is Apple-modified.
The standard has the copying operations of std::basic_streambuf
unspecified (in the regular-world sense, not the C++ sense), so that
class template should get copying operations by default. I took
advantage of that in my class template. However, your streambuf code
explicitly makes streambufs noncopyable (by making the copy constructor
and assignment operator private). It claims DR 50 as the reason, but
that DR (at
<http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#50>) only
mentions std::ios_base!
Why did you make the change? Is it corrected in later versions? If
you're not going to correct it, how should I block the code off (with
the preprocessor)?
Daryle
More information about the Gcc
mailing list