Ron Natalie wrote:
wi******@hotmail.com wrote:
I couldn't compile it either (on gcc 3.4.2), that's what triggered my
slightly unscientific comments ....
It compiles because he didn't do anything that in his implementation
tripped across the lack of an accessible copy constructor/assignment
op.
Not being copy constructible etc. doesn't mean not having an accessible
copy constructor/assignment op. It means that the semantics of
copyability as defined for containers aren't met. This subtle-sounding
distinction is important because it means that it's okay for the
implementation to provide a copy constructor and an assignment operator,
but they don't have to do what a container expects. In particular,
copying these things can be used to initialize global stream objects
(such as cout), which doesn't involve copying buffer contents. That's
the old ostream_with_assign stuff; it's still legitimate, and some
implementations use it. Which is why the original code compiled, but
didn't do what its author expected.
--
Pete Becker
Dinkumware, Ltd. (
http://www.dinkumware.com)