This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Reworked nonstd pointer patch
- From: Bob Walters <mostlyharmless77 at yahoo dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Tue, 28 Oct 2008 22:27:21 -0400
- Subject: Reworked nonstd pointer patch
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.
Attachment:
nonstd_pointer.patch
Description: Binary data