39 #pragma GCC system_header
46 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
48 _GLIBCXX_BEGIN_NAMESPACE_VERSION
61 template<
typename _Tp>
66 typedef _Tp element_type;
75 set(element_type* __arg)
81 {
return (_M_value < __rarg._M_value); }
85 {
return (_M_value == __rarg._M_value); }
88 element_type* _M_value;
104 template<
typename _Tp>
108 typedef _Tp element_type;
116 return reinterpret_cast<_Tp*
>(
reinterpret_cast<_UIntPtrType
>(
this)
126 _M_diff =
reinterpret_cast<_UIntPtrType
>(__arg)
127 - reinterpret_cast<_UIntPtrType>(
this);
133 {
return (reinterpret_cast<_UIntPtrType>(this->
get())
134 < reinterpret_cast<_UIntPtrType>(__rarg.get())); }
138 {
return (reinterpret_cast<_UIntPtrType>(this->
get())
139 == reinterpret_cast<_UIntPtrType>(__rarg.get())); }
142 #ifdef _GLIBCXX_USE_LONG_LONG
143 typedef __gnu_cxx::__conditional_type<
144 (
sizeof(
unsigned long) >=
sizeof(
void*)),
145 unsigned long,
unsigned long long>::__type _UIntPtrType;
147 typedef unsigned long _UIntPtrType;
149 _UIntPtrType _M_diff;
156 template<
typename _Tp>
160 typedef const _Tp element_type;
168 return reinterpret_cast<const _Tp*
>
169 (
reinterpret_cast<_UIntPtrType
>(
this) + _M_diff);
173 set(
const _Tp* __arg)
178 _M_diff =
reinterpret_cast<_UIntPtrType
>(__arg)
179 - reinterpret_cast<_UIntPtrType>(
this);
185 {
return (reinterpret_cast<_UIntPtrType>(this->
get())
186 < reinterpret_cast<_UIntPtrType>(__rarg.get())); }
190 {
return (reinterpret_cast<_UIntPtrType>(this->
get())
191 == reinterpret_cast<_UIntPtrType>(__rarg.get())); }
194 #ifdef _GLIBCXX_USE_LONG_LONG
195 typedef __gnu_cxx::__conditional_type<
196 (
sizeof(
unsigned long) >=
sizeof(
void*)),
197 unsigned long,
unsigned long long>::__type _UIntPtrType;
199 typedef unsigned long _UIntPtrType;
201 _UIntPtrType _M_diff;
211 template<
typename _Tp>
212 struct _Reference_type
213 {
typedef _Tp& reference; };
216 struct _Reference_type<void>
217 {
typedef _Invalid_type& reference; };
220 struct _Reference_type<const void>
221 {
typedef const _Invalid_type& reference; };
224 struct _Reference_type<volatile void>
225 {
typedef volatile _Invalid_type& reference; };
228 struct _Reference_type<volatile const void>
229 {
typedef const volatile _Invalid_type& reference; };
236 template<
typename _Tp>
238 {
typedef _Tp type; };
240 template<
typename _Tp>
242 {
typedef _Tp type; };
244 template<
typename _Tp>
245 struct _Unqualified_type<volatile _Tp>
246 {
typedef volatile _Tp type; };
248 template<
typename _Tp>
249 struct _Unqualified_type<volatile const _Tp>
250 {
typedef volatile _Tp type; };
284 template<
typename _Storage_policy>
288 typedef typename _Storage_policy::element_type element_type;
292 typedef typename _Unqualified_type<element_type>::type value_type;
293 typedef std::ptrdiff_t difference_type;
295 typedef typename _Reference_type<element_type>::reference reference;
310 template<
typename _Up>
316 template<
typename _Up>
331 template<
typename _Up>
339 template<
typename _Up>
341 operator=(_Up* __arg)
350 {
return *(_Storage_policy::get()); }
355 {
return _Storage_policy::get(); }
359 operator[](std::ptrdiff_t __index)
const
360 {
return _Storage_policy::get()[__index]; }
367 operator __unspecified_bool_type()
const
369 return _Storage_policy::get() == 0 ? 0 :
370 &_Pointer_adapter::operator->;
376 {
return (_Storage_policy::get() == 0); }
379 inline friend std::ptrdiff_t
381 {
return (__lhs.get() - __rhs); }
383 inline friend std::ptrdiff_t
385 {
return (__lhs - __rhs.get()); }
387 template<
typename _Up>
388 inline friend std::ptrdiff_t
390 {
return (__lhs.get() - __rhs); }
392 template<
typename _Up>
393 inline friend std::ptrdiff_t
395 {
return (__lhs - __rhs.get()); }
397 template<
typename _Up>
398 inline std::ptrdiff_t
400 {
return (_Storage_policy::get() - __rhs.get()); }
409 #define _CXX_POINTER_ARITH_OPERATOR_SET(INT_TYPE) \
410 inline friend _Pointer_adapter \
411 operator+(const _Pointer_adapter& __lhs, INT_TYPE __offset) \
412 { return _Pointer_adapter(__lhs.get() + __offset); } \
414 inline friend _Pointer_adapter \
415 operator+(INT_TYPE __offset, const _Pointer_adapter& __rhs) \
416 { return _Pointer_adapter(__rhs.get() + __offset); } \
418 inline friend _Pointer_adapter \
419 operator-(const _Pointer_adapter& __lhs, INT_TYPE __offset) \
420 { return _Pointer_adapter(__lhs.get() - __offset); } \
422 inline _Pointer_adapter& \
423 operator+=(INT_TYPE __offset) \
425 _Storage_policy::set(_Storage_policy::get() + __offset); \
429 inline _Pointer_adapter& \
430 operator-=(INT_TYPE __offset) \
432 _Storage_policy::set(_Storage_policy::get() - __offset); \
435 // END of _CXX_POINTER_ARITH_OPERATOR_SET macro
438 _CXX_POINTER_ARITH_OPERATOR_SET(
short);
439 _CXX_POINTER_ARITH_OPERATOR_SET(
unsigned short);
440 _CXX_POINTER_ARITH_OPERATOR_SET(
int);
441 _CXX_POINTER_ARITH_OPERATOR_SET(
unsigned int);
442 _CXX_POINTER_ARITH_OPERATOR_SET(
long);
443 _CXX_POINTER_ARITH_OPERATOR_SET(
unsigned long);
479 #define _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(OPERATOR) \
480 template<typename _Tp1, typename _Tp2> \
482 operator OPERATOR(const _Pointer_adapter<_Tp1>& __lhs, _Tp2 __rhs) \
483 { return __lhs.get() OPERATOR __rhs; } \
485 template<typename _Tp1, typename _Tp2> \
487 operator OPERATOR(_Tp1 __lhs, const _Pointer_adapter<_Tp2>& __rhs) \
488 { return __lhs OPERATOR __rhs.get(); } \
490 template<typename _Tp1, typename _Tp2> \
492 operator OPERATOR(const _Pointer_adapter<_Tp1>& __lhs, \
493 const _Pointer_adapter<_Tp2>& __rhs) \
494 { return __lhs.get() OPERATOR __rhs.get(); } \
496 // End GCC_CXX_POINTER_COMPARISON_OPERATION_SET Macro
499 _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(==)
500 _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(!=)
501 _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(<)
502 _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(<=)
503 _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(>)
504 _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(>=)
507 template<typename _Tp>
510 {
return __lhs.get() ==
reinterpret_cast<void*
>(__rhs); }
512 template<
typename _Tp>
514 operator==(
int __lhs,
const _Pointer_adapter<_Tp>& __rhs)
515 {
return __rhs.get() ==
reinterpret_cast<void*
>(__lhs); }
517 template<
typename _Tp>
519 operator!=(
const _Pointer_adapter<_Tp>& __lhs,
int __rhs)
520 {
return __lhs.get() !=
reinterpret_cast<void*
>(__rhs); }
522 template<
typename _Tp>
524 operator!=(
int __lhs,
const _Pointer_adapter<_Tp>& __rhs)
525 {
return __rhs.get() !=
reinterpret_cast<void*
>(__lhs); }
531 template<
typename _Tp>
535 {
return __lhs._Tp::operator==(__rhs); }
537 template<
typename _Tp>
539 operator<=(const _Pointer_adapter<_Tp>& __lhs,
540 const _Pointer_adapter<_Tp>& __rhs)
541 {
return __lhs._Tp::operator<(__rhs) || __lhs._Tp::operator==(__rhs); }
543 template<
typename _Tp>
545 operator!=(
const _Pointer_adapter<_Tp>& __lhs,
546 const _Pointer_adapter<_Tp>& __rhs)
547 {
return !(__lhs._Tp::operator==(__rhs)); }
549 template<
typename _Tp>
551 operator>(
const _Pointer_adapter<_Tp>& __lhs,
552 const _Pointer_adapter<_Tp>& __rhs)
553 {
return !(__lhs._Tp::operator<(__rhs) || __lhs._Tp::operator==(__rhs)); }
555 template<
typename _Tp>
557 operator>=(
const _Pointer_adapter<_Tp>& __lhs,
558 const _Pointer_adapter<_Tp>& __rhs)
559 {
return !(__lhs._Tp::operator<(__rhs)); }
561 template<
typename _CharT,
typename _Traits,
typename _StoreT>
563 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
564 const _Pointer_adapter<_StoreT>& __p)
565 {
return (__os << __p.get()); }
567 _GLIBCXX_END_NAMESPACE_VERSION
bitset< _Nb > & set()
Sets every bit to true.
Controlling output.This is the base class for all output streams. It provides text formatting of all ...
A storage policy for use with _Pointer_adapter<> which stores the pointer's address as an offset va...
Random-access iterators support a superset of bidirectional iterator operations.
A storage policy for use with _Pointer_adapter<> which yields a standard pointer. ...