[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FW: gcc/stl question
From: |
Mark Mitchell |
Subject: |
Re: FW: gcc/stl question |
Date: |
Fri, 20 Apr 2001 00:35:31 -0700 |
>>>>> "James" == James Crotinger <address@hidden> writes:
James> Mark, does this mean that
James> vector<int> a(10,5);
James> will select the template constructor (since 10 is not an
Yes, I believe so. If you write 5U then I think the other construtor
will get called. The really pathological case is:
vector<size_t> a((size_t) 10, (size_t) 5);
You get lucky in this case because when two functions match equally
well, the non-template version is preferred.
James> unsigned int)? I could have sworn that special things were
James> supposed to be done to make this do what people expected it
James> to do, and I just figured that the pointer case would be
James> similarly handled.
There was talk of doing something special at some point in the
standardization process, but I don't think that every came to
anything.
James> (BTW, is my recollection correct that I can safely leave
James> the initialization off in the test below - vector always
James> initializes its memory with the default constructor,
James> right?)
Right.
--
Mark Mitchell address@hidden
CodeSourcery, LLC http://www.codesourcery.com