GCC vector element access pointers in C++
Tue Jan 26 09:13:00 GMT 2016
Thanks for such a quick reply, I appreciate it.
Yes I am trying to speed up my testing in debug as working with point clouds of +600,000 points stored in vectors is really really slow, thus using _ MyFirst and _MyLast removes all the dereferencing/accessing overheads as I work directly with pointers and can just increment pointer addresses, plus even if the vector gets resized _ MyFirst and _MyLast are not affected.
I did look through the stl_vector.h but it sadly seems that I can not use ._M_impl._M_start. I am aware that compiler will remove all the overheads in release but currently in debugging I need a fast way to access and move through the vector.
From: Marc Glisse [mailto:email@example.com]
Sent: 26 January 2016 09:06
To: Marius Miknis <firstname.lastname@example.org>
Subject: Re: GCC vector element access pointers in C++
On Tue, 26 Jan 2016, Marius Miknis wrote:
> I do apologise if this might be wrong email to pose such a question.
> I wanted to ask what is the GCC C++ equivalent implementation of Windows _ MyFirst and _MyLast vector pointers?
> These give direct access to the vectors first and last element, but they ar e not present in the GCC implementation of the vector class.
The best thing you can do is read the source. From the file vector, you can see that you need to read the file bits/stl_vector.h. And there you will find 2 private members that you cannot use anyway. Or is this for use in a debugger?
More information about the Gcc-help