vector<>.begin()

Jeff Williams jwilliams@mfchelp.com
Fri Nov 7 14:17:00 GMT 2003


Hello all, I just stopped using STLport and decided to use libstdc++ seeing as was using gcc anyways.  Ok enough background.

The only problem I had in the switch is libstdc++ vector.begin() is not a ptr type.  I read the faq, and I know the "deal".  Now, here is my proposal:

All I did was edit the file:
stl_iterator.h and add the following conversion operator to class __normal_iterator:

operator pointer() const { return _M_current; }

This fixes the problem of vector.begin() not being a ptr to the first element and is syntatically cleaner that &*v.begin();

So, for starters I realize I am not some super genius who is the only one to think of this, therefore, I have to ask, why is this conversion operator not included already?  And secondly, is it a bad idea for me to put it in there even   if "you all" decide not to include such a change?  Aside from the fact that I'll have to keep adding it each time a new version comes out...

Jeff




More information about the Libstdc++ mailing list