This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: plans to support STL ?


Igor Markov <imarkov@math.ucla.edu> writes:
>  I just tried to use STLport3.0 (which recommends egcs over gcc2.7.2)
>  and egcs failed miserably ---

I don't know who's correct here, but your problem is common and easy
to work around.  It's related to using literal values as arguments to
templated functions and happens even when there's no ambiguity.

This program doesn't compile: 
-----------
#include <vector> 
int 
main(int argc, char ** argv) {
  vector<int> p(2, 1);
  return 0;  
}
-----------

This one does: 
-----------
#include <vector> 
int 
main(int argc, char ** argv) {
  int i = 1;	
  vector<int> p(2, i);
  return 0;  
}
-----------

If you get an error like this:

/usr/local/egcs-19980205/include/g++/stl_vector.h:113: no type named `iterator_category' in `int'
/usr/local/egcs-19980205/include/g++/stl_vector.h:113: no type named `value_type' in `int'
/usr/local/egcs-19980205/include/g++/stl_vector.h:113: no type named `difference_type' in `int'
/usr/local/egcs-19980205/include/g++/stl_vector.h:113: no type named `pointer' in `int'
/usr/local/egcs-19980205/include/g++/stl_vector.h:113: no type named `reference' in `int'
/usr/local/egcs-19980205/include/g++/stl_iterator.h: In function `{error} iterator_category<int>(const int &)':
/usr/local/egcs-19980205/include/g++/stl_iterator.h:126: confused by earlier errors, bailing out

start looking for integer literals as arguments to STL functions.  

Bill Gribble


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]