Mail Archives: djgpp/2003/11/03/09:46:19
Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de> wrote:
> leila <gcceducate AT tutorialwizard DOT net> wrote:
>
> > #include <iostream>
> > #include <vector>
> > using namespace std;
> > int main()
> > {
> > int val[10] = {1,2,2,2,2,4,7,8,9,6};
> > int saveVal;
> > vector v1(val, val+10); // **** This is where the error starts
>
> Throw away whatever book or tutorial made you think this is a correct
> usage of the stuff declared in standard header <vector>, and replace
> it by a usable C++ textbook.
The OP's example code wasn't that far off - she just omitted the type
specialization when she declared v1. That's a pretty common typo, and
I'm not sure it justifies throwing away the book (although I agree
that a disturbingly high percentage of C++ books are pretty bad and
deserve to be thrown away).
> The people over in comp.lang.c++ (where
> this question really belongs, since it has no particular relation to
> DJGPP) will have a list of usable ones in their FAQ list.
Agreed, on both counts.
Best regards,
Tom
- Raw text -