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]

STL vector with gcc 2.97 20001119


Hi,

I'm not sure whether this belongs here or on the libstdc++ lists. I just
downloaded a recent gcc snapshot (2.97 20001119) and noticed that the following
program that compiled with g++ 2.95.2 doesn't compile with the latest g++
snapshot.


#include <vector>
using namespace std;
int main()
{
 vector<float> a(1,0);
 float *b = a.begin();
}

> /usr/local/bin/g++ test.cc -o test
test.cc: In function `int main()':
test.cc:10: cannot convert `std::__normal_iterator<float*, std::vector<float, 
   std::allocator<float> > >' to `float*' in initialization

It seems like the iterator type for the STL vector<T> changed so that it isn't a
T* anymore. While, I know that it is not enforced by ANSI C++, it is still very,
very annoying, since it is not possible to use C functions that take (float *)
as input and pass it aVector.begin() as arguments. Is there anything that can be
done about that? If I'm posting to the wrong list, could you direct me to the
right place please.

	Jean-Marc

-- 
Jean-Marc Valin
Universite de Sherbrooke - Genie Electrique
valj01@gel.usherb.ca

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