FAQ Entry

Joe Buck jbuck@synopsys.com
Wed Jan 7 09:59:00 GMT 1998


Mark Mitchell writes:
>   Here's another entry for the egcs FAQ, which I thought Joe might
> want in his FAQ as well:

[ problems with vector<int> vi(10, 3); ]

As far as I know, I'm the only one who ever asked the Q on egcs (I think I
reported problems with this as a bug once), so it isn't exactly FA.
Still, I could include it.

But I'm not really happy with the answer.

For one thing, it begs the question of how to create a vector containing
10 unsigned ints, each initialized to 3U.  Yes, I suppose I can write

	vector<unsigned> vu(10, 3U);

since the types are now different.  But this feels artificial.

Don't we really need specializations to do this right?  Then vector<int>
vi(10, 3) could be made to work.



More information about the Gcc mailing list