basic_streambuf<> and copying

Benjamin Kosnik bkoz@cygnus.com
Wed Jun 9 00:29:00 GMT 1999


> > 50.  Copy constructor and assignment operator of ios_base
> > (trying to figure out if ios_base is copy-able)
> 
> I can't quite understand the LWG comment on this issue: Since
> basic_ios is not copyable, how could you use a copyable ios_base?

You and me both.

basic_ios is publically constructable, but is not copy-able, or
assign-able.

ios_base is not publically constructable (protected ctor), but apparently
"copy-able and assign-able"

I think this appears to be another mis-mash that appeared after the
separation of ios_base and basic_ios. Matt, I believe you filed this
defect report, can you provide any insight? 

> > That being said, with all the pointers in basic_streambuf, we are left
> > with two options:
> > 
> > 1) it may indeed be wise to make the assignment operators/copy ctor
> > private, which would prohibit copying and is not conformant to the standard.
> > 
> > 2) make deep copies, no matter how painful this.
> 
> There is a third option: Decide that it is an omission in the
> standard, make the copy ctor private and unimplemented, and raise it
> as a library issue.

Yeah. Raise away. We could wrap 

#ifdef _G_RESOLVE_LIB_DEFECTS
private:
 streambuf(const streambuf&);
 streambuf& operator=(const streambuf&);
#else
 // Fail miserably, as we are currently doing.
#endif


-Benjamin



More information about the Libstdc++ mailing list