c++/8285: default arg doesn't work in vector
Sat Oct 19 08:50:00 GMT 2002
Thanks nathan, the vector constructor use the copy
constructor to create the other n-1 objects of the
vector when called with vector<T>(n) but it created an
instance for each element for vector<T>(n, v).
i saw one object was created, i just couldn't figure
out why the rest weren't.
Thanks, you r the man. but Nathan, i can't remember
reading about this in the C++ Programming Language.
Is this how it should work? I know, my class should
have a copy constructor if it has pointer members, i
just didn't think the vector would use it.
--- email@example.com wrote:
> Synopsis: default arg doesn't work in vector
> State-Changed-From-To: open->feedback
> State-Changed-By: nathan
> State-Changed-When: Sat Oct 19 08:25:13 2002
> I suspect coding error. You have no user defined
> copy constructor, therefore one is synthesized by
> the compiler. If it is ever invoked, you'll end up
> deleting the same int twice.
> Please confirm whether that fixes the problem or
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
More information about the Gcc-bugs