Go to the source code of this file.
This is an internal header file, included by other library headers. Do not attempt to use it directly. {ext/pointer.h}
namespace __gnu_cxx _GLIBCXX_VISIBILITY |
( |
default |
| ) |
|
These functions are here to allow containers to support non standard pointer types. For normal pointers, these resolve to the use of the standard cast operation. For other types the functions will perform the apprpriate cast to/from the custom pointer class so long as that class meets the following conditions: 1) has a typedef element_type which names tehe type it points to. 2) has a get() const method which returns element_type*. 3) has a constructor which can take one element_type* argument.
This type supports the semantics of the pointer cast operators (below.)
Casting operations for cases where _FromType is not a standard pointer. _ToType can be a standard or non-standard pointer. Given that _FromType is not a pointer, it must have a get() method that returns the standard pointer equivalent of the address it points to, and must have an element_type typedef which names the type it points to.
Casting operations for cases where _FromType is a standard pointer. _ToType can be a standard or non-standard pointer.
35 _GLIBCXX_BEGIN_NAMESPACE_VERSION
51 template<
typename _ToType>
53 {
typedef typename _ToType::element_type* type; };
55 template<
typename _ToType>
56 struct _Caster<_ToType*>
57 {
typedef _ToType* type; };
66 template<
typename _ToType,
typename _FromType>
68 __static_pointer_cast(
const _FromType& __arg)
69 {
return _ToType(
static_cast<typename _Caster<_ToType>::
70 type
>(__arg.get())); }
72 template<
typename _ToType,
typename _FromType>
74 __dynamic_pointer_cast(
const _FromType& __arg)
75 {
return _ToType(
dynamic_cast<typename _Caster<_ToType>::
76 type
>(__arg.get())); }
78 template<
typename _ToType,
typename _FromType>
80 __const_pointer_cast(
const _FromType& __arg)
81 {
return _ToType(
const_cast<typename _Caster<_ToType>::
82 type
>(__arg.get())); }
84 template<
typename _ToType,
typename _FromType>
86 __reinterpret_pointer_cast(
const _FromType& __arg)
87 {
return _ToType(
reinterpret_cast<typename _Caster<_ToType>::
88 type
>(__arg.get())); }
94 template<
typename _ToType,
typename _FromType>
96 __static_pointer_cast(_FromType* __arg)
97 {
return _ToType(
static_cast<typename _Caster<_ToType>::
100 template<
typename _ToType,
typename _FromType>
102 __dynamic_pointer_cast(_FromType* __arg)
103 {
return _ToType(
dynamic_cast<typename _Caster<_ToType>::
106 template<
typename _ToType,
typename _FromType>
108 __const_pointer_cast(_FromType* __arg)
109 {
return _ToType(
const_cast<typename _Caster<_ToType>::
112 template<
typename _ToType,
typename _FromType>
114 __reinterpret_pointer_cast(_FromType* __arg)
115 {
return _ToType(
reinterpret_cast<typename _Caster<_ToType>::
118 _GLIBCXX_END_NAMESPACE_VERSION