This is the mail archive of the gcc-help@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]
Other format: [Raw text]

problems using vector in gcc3.2


this peace of code:
#include <iostream>
#include <vector>
using namespace std;
int main(){
   std::vector <int> v;
   v.push_back(5);
   cout<<v[0]<<endl;
   const  int * beg = v.begin();


    return 0;
}


compiles with no warnings or errors in gcc 2.96, but
when I try to compile it with gcc 3.2, I get the
following error message:
[me@my xx]$ gcc -c xx.cpp
xx.cpp: In function `int main()':
xx.cpp:8: cannot convert
`__gnu_cxx::__normal_iterator<int*, std::vector<int,
   std::allocator<int> > >' to `const int*' in
initialization

How can one solve this problem (besides compiling the
code with the old compiler)?
thanks in advance


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