c++/8285: default arg doesn't work in vector

VLA verrola@yahoo.com
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.  

Thanks again.

.v
--- nathan@gcc.gnu.org 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
> State-Changed-Why:
>     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
> not.
> 
>
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8285


__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/



More information about the Gcc-bugs mailing list