FW: gcc/stl question
Mark Mitchell
mark at codesourcery.com
Fri Apr 20 07:35:31 UTC 2001
>>>>> "James" == James Crotinger <JimC at proximation.com> 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 mark at codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the pooma-dev
mailing list