Reworked nonstd pointer patch

Bob Walters mostlyharmless77@yahoo.com
Wed Oct 29 02:28:00 GMT 2008


Patch for non-standard pointer support, with all requested changes.   
Sorry this has taken so long.

All changes requested were made, including renaming _ExtPtr_Allocator.

A couple of other changes:

(a) As indicated in prior post, the _Pointer_adapter now inherits from  
its storage policy so that the policy can publicly extend the API of  
the pointer type in a way that a specific allocator can take advantage  
of.

(b) Pointer comparisons for _Pointer_adapters<_Tp> of the same type,  
will defer to methods on the storage policy for comparisons.  This is  
safer as their are conceivably segmented memory schemes which might  
map segments at different virtual addresses in different processes,  
making comparisons by get() invalid.  Comparisons to native pointers  
or to pointers of different types still perform the comparison using  
the standard pointer value yielded by get().

(c) Did a little work on the constructors and assignment operators  
such that I think the _Pointer_adapter now allows construction or  
assignment with implicit conversions, under the same circumstances  
that such conversions are allowed by the compiler (e.g. Tp* to const  
Tp*, but not the other way around.)  A neg_1.cc test was added to test  
that invalid implicit conversions cause appropriate compile errors  
with the template.

(d) The overload __static_pointer_cast<To,From> functions were  
enhanced to support the conversion of _Pointer_adapters to  
_Pointer_adapters of other types, and also to standard pointers, so  
long as the associated standard cast operation would work.

All enclosed tests work on  x86_darwin.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: nonstd_pointer.patch
Type: application/octet-stream
Size: 67997 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20081029/75a2b14c/attachment.obj>
-------------- next part --------------



More information about the Libstdc++ mailing list