This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why did you make streambufs noncopyable?


Note that C++ library questions should go to a different list; see
http://gcc.gnu.org/lists.html.


On Wed, Jun 04, 2003 at 12:08:16AM -0400, Daryle Walker wrote:
> 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!

The comment says "side effect" of DR 50.


> Why did you make the change?

How -- precisely -- would copying semantics work for streambufs?  Shallow
copy?  Deep copy?  If buffer A is copied to buffer B, then buffer A reads
from the underlying source or writes to the underlying sink, what state
is buffer B in?

I guarantee that no matter what answers you think are "obvious" and
"intuitive," other users will find those decisions to be "wrong".


> Is it corrected in later versions?

It's not a bug.


> If 
> you're not going to correct it, how should I block the code off (with 
> the preprocessor)?

????


-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]