This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: egcs-1.0.2 STL problem?
- To: pinwu_xu at hotmail dot com (Pinwu Xu)
- Subject: Re: egcs-1.0.2 STL problem?
- From: Joe Buck <jbuck at synopsys dot com>
- Date: Wed, 25 Mar 98 11:07:21 PST
- Cc: egcs at cygnus dot com
> Hi there,
> I've been having problem with the following code section:
>
> #include<proper head>
>
> main()
> {
> vector<int> a_i_vec(5, 0);
> ....
> }
This is a known problem. What's happening is that the compiler tries to
instantiate the two-iterator constructor because both arguments have the
same type. That is, it thinks you asked for vector::vector(InputIter,
InputIter), not vector::vector(size_type n, const T& value). Ideally we
should have specializations to take care of this case.
> if I change the main() code to
> int dummy_int(0);
> vector<int> a_i_vec(5, dummy_int);
>
> it works. You can find the examples for the former code in
> several books for STL. It would be appreciated if somebody
> could shed a light.
a_i_vec(5U, 0) would also work.