Mail Archives: djgpp/1998/05/15/15:00:51
From: | wjae AT plex DOT nl (Wiel Aerts)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | problem with stl: vector
|
Date: | Fri, 15 May 1998 17:49:13 GMT
|
Organization: | Plex -- a public access Internet provider
|
Lines: | 55
|
Message-ID: | <355c7fcd.2178639@news.plex.nl>
|
NNTP-Posting-Host: | news.plex.nl
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I tried to use the stl vector class, and I got into problems:
The smallest program with the errors is:
#include <vector>
int main ()
{
vector<int> v (10, 12);
return 0;
}
I got the following errors from g++ -Wall test.cc:
c:/djgpp/lang/cxx/stl_vector.h:113: no type named `iterator_category'
in `int'
c:/djgpp/lang/cxx/stl_vector.h:113: no type named `value_type' in
`int'
c:/djgpp/lang/cxx/stl_vector.h:113: no type named `difference_type' in
`int'
c:/djgpp/lang/cxx/stl_vector.h:113: no type named `pointer' in `int'
c:/djgpp/lang/cxx/stl_vector.h:113: no type named `reference' in `int'
c:/djgpp/lang/cxx/stl_iterator.h: In function `{error}
iterator_category<int>(co
nst int &)':
c:/djgpp/lang/cxx/stl_iterator.h:127: warning: ANSI C++ forbids
typedef which
does not specify a type
Abort!
I tried some things and found that the following program
compiled well:
int main()
{
int n = 12;
vector<int> (10, n);
return 0;
}
also the variants with other types were OK:
vector <double> v (10, 12.0), and vector<char> v (10, 'a'), ....
I searched in the archives and found similar (I believe the same)
problem (but no answers) with vector class .
Is this a bug in stl?
Can it be fixed with some change in the header file?
Thank you very much in advance for your help.
Wiel Aerts
wjae AT plex DOT nl
- Raw text -