Alt pointer support for vector

Bob Walters bob.s.walters@gmail.com
Fri Oct 10 01:03:00 GMT 2008


Thanks Paolo.  I will take care of everything you mentioned (incl.  
_ExtPtr_allocator), and post up a SVN diff when done.

I do want to double check one thing:  The static_pointer_cast<>  
functions for _Pointer_adapter were deliberately missing the usual  
underscores.  I had intended to make that pointer follow the API  
conventions for extended pointers that TR1 laid out with shared_ptr.    
So there was a specific reason why that didn't match GNU standards.   
That said, I will change it to __static_pointer_cast<> if you still  
want me to.

There are two minor material changes that I also will include in the  
new patch:

(a) The _Pointer_adapter will inherit from its Storage_policy, so that  
in the case of smart pointer implementations, the API of the pointer  
can be extended via inheritance, and the associated allocator can take  
advantage of the additional APIs.  This idea came from discussions  
with Phil Bouchard, and helped meet some of his specific needs.

(b) The _Pointer_adapter should do pointer comparison by using an  
operator==() / operator<() from the Storage_policy passed to it, and  
not by comparing the native pointer values.  In certain segmented  
memory schemes, it is possible that comparing the native pointer value  
in different processes would yield different, invalid results in  
different processes.

I am involved in a lot of work at present.  It may take me from a few  
days to a week to send these changes up to you.

Thanks,
- Bob


On Oct 9, 2008, at 5:15 AM, Paolo Carlini wrote:

> Hi Bob,
>> Paolo,
>>
>> Attached is the diff containing the alternative pointer support for
>> vector, along with all necessary infrastructure and test cases.  All
>> of this is working.
> I have some comments for a new iteration, which, I think will bring us
> much closer to actually committing the ext/ bits and the testcases:
> 1- The correct namespace is __gnu_cxx, not __gcc_cxx.
> 2- Watch formatting, alignments, stylistic issues: for example  
> pointer.h
> uses the wrong tabs (*all* tabs, elsewhere too, must be only 2  
> spaces),
> I also see spaces between open ( and the text and then between the  
> text
> and the closed ), I see open { alone in a line and the text the next
> line, I see _T (ando also plain T) and _S, and _U, which are dangerous
> (always use 2-3 chars at least for the name), I see space between the
> template keyword and <, the name in cast.h are not uglified at all
> (__const_pointer_cast, not const_pointer_cast, etc); names of  
> functions
> and the next open { must be aligned to the same column; instead, the
> name of a template function must be a tab (2 spaces) to the right of  
> the
> template keyword before, likewise between template and class for a
> template class; really, lots of issues, please take some time to fix
> them, by comparing your code to anything already existing in
> include/bits/ or include/std or include/tr1...
> 3- placement new wants ::new.
> 4- I don't like the name _NonStd_allocator, doesn't hint at all to the
> relevant "extended pointer" feature. _ExtPtr_allocator is already  
> better
> (by the way, getUnderlyingImp is not uglified). But I'm certainly open
> to different suggestions. Then, however, remember to fix all the  
> related
> names, in testcase dirs, etc.
> 5- Some of your new files lack the FSF header, or have wrong Copyright
> dates (only 2008 of course, for new files), or mention the wrong
> contributors.
>
> Paolo.



More information about the Libstdc++ mailing list