
Peter Dimov skrev:
Thorsten Ottosen wrote:
Michael Marcin skrev:
Thorsten Ottosen wrote:
I'll try to investigate this.
I appreciate it. If you have things you'd like me to try out I can compile them and send you the mixed assembly output.
One thing I noticed is that it seems to fail to eliminate the return value copy of the void_ptr_iterator::base call. Accessing iter_ directly (unfortunately) produces much better code but still not the best. I have tried playing a little with your example, eg. using operator[] instead.
To my surprise, I could not eliminate the overhead with vc8 (/Ox /Og). Thus the iterator wrapping seems to pay some penalty. This is quite strange IMO.
It's possible that the implementation in terms of vector<void*> is introducing too much abstraction for the compiler to handle. Have you considered simply using vector<T*> and leaving the void* folding to the standard library?
Yes. I certainly have considered this. I'm leaning somewhat towards it. Going for void* introduced a number of imperfections in the library, like algorithms as members. -Thorsten