This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
vector<>.begin()
- From: Jeff Williams <jwilliams at mfchelp dot com>
- To: <libstdc++ at gcc dot gnu dot org>
- Date: Fri, 7 Nov 2003 9:17:53 -0500
- Subject: vector<>.begin()
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