39 #pragma GCC system_header 45 #if __cplusplus >= 201103L 50 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
52 _GLIBCXX_BEGIN_NAMESPACE_VERSION
65 template<
typename _Tp>
70 typedef _Tp element_type;
79 set(element_type* __arg)
85 {
return (_M_value < __rarg._M_value); }
89 {
return (_M_value == __rarg._M_value); }
92 element_type* _M_value;
108 template<
typename _Tp>
112 typedef _Tp element_type;
120 return reinterpret_cast<_Tp*>(reinterpret_cast<_UIntPtrType>(
this)
130 _M_diff = reinterpret_cast<_UIntPtrType>(__arg)
131 - reinterpret_cast<_UIntPtrType>(
this);
137 {
return (reinterpret_cast<_UIntPtrType>(this->get())
138 < reinterpret_cast<_UIntPtrType>(__rarg.get())); }
142 {
return (reinterpret_cast<_UIntPtrType>(this->get())
143 == reinterpret_cast<_UIntPtrType>(__rarg.get())); }
146 #ifdef _GLIBCXX_USE_LONG_LONG 147 typedef __gnu_cxx::__conditional_type<
148 (
sizeof(
unsigned long) >=
sizeof(
void*)),
149 unsigned long,
unsigned long long>::__type _UIntPtrType;
151 typedef unsigned long _UIntPtrType;
153 _UIntPtrType _M_diff;
160 template<
typename _Tp>
164 typedef const _Tp element_type;
172 return reinterpret_cast<const _Tp*>
173 (reinterpret_cast<_UIntPtrType>(
this) + _M_diff);
177 set(
const _Tp* __arg)
182 _M_diff = reinterpret_cast<_UIntPtrType>(__arg)
183 - reinterpret_cast<_UIntPtrType>(
this);
189 {
return (reinterpret_cast<_UIntPtrType>(this->get())
190 < reinterpret_cast<_UIntPtrType>(__rarg.get())); }
194 {
return (reinterpret_cast<_UIntPtrType>(this->get())
195 == reinterpret_cast<_UIntPtrType>(__rarg.get())); }
198 #ifdef _GLIBCXX_USE_LONG_LONG 199 typedef __gnu_cxx::__conditional_type<
200 (
sizeof(
unsigned long) >=
sizeof(
void*)),
201 unsigned long,
unsigned long long>::__type _UIntPtrType;
203 typedef unsigned long _UIntPtrType;
205 _UIntPtrType _M_diff;
215 template<
typename _Tp>
216 struct _Reference_type
217 {
typedef _Tp& reference; };
220 struct _Reference_type<void>
221 {
typedef _Invalid_type& reference; };
224 struct _Reference_type<const void>
225 {
typedef const _Invalid_type& reference; };
228 struct _Reference_type<volatile void>
229 {
typedef volatile _Invalid_type& reference; };
232 struct _Reference_type<volatile const void>
233 {
typedef const volatile _Invalid_type& reference; };
240 template<
typename _Tp>
242 {
typedef _Tp type; };
244 template<
typename _Tp>
246 {
typedef _Tp type; };
280 template<
typename _Storage_policy>
284 typedef typename _Storage_policy::element_type element_type;
288 typedef typename _Unqualified_type<element_type>::type value_type;
289 typedef std::ptrdiff_t difference_type;
291 typedef typename _Reference_type<element_type>::reference reference;
299 { _Storage_policy::set(__arg); }
303 { _Storage_policy::set(__arg.get()); }
306 template<
typename _Up>
308 { _Storage_policy::set(__arg); }
312 template<
typename _Up>
314 { _Storage_policy::set(__arg.get()); }
323 _Storage_policy::set(__arg.get());
327 template<
typename _Up>
331 _Storage_policy::set(__arg.get());
335 template<
typename _Up>
337 operator=(_Up* __arg)
339 _Storage_policy::set(__arg);
346 {
return *(_Storage_policy::get()); }
351 {
return _Storage_policy::get(); }
355 operator[](std::ptrdiff_t __index)
const 356 {
return _Storage_policy::get()[__index]; }
363 operator __unspecified_bool_type()
const 365 return _Storage_policy::get() == 0 ? 0 :
366 &_Pointer_adapter::operator->;
372 {
return (_Storage_policy::get() == 0); }
375 inline friend std::ptrdiff_t
377 {
return (__lhs.get() - __rhs); }
379 inline friend std::ptrdiff_t
381 {
return (__lhs - __rhs.get()); }
383 template<
typename _Up>
384 inline friend std::ptrdiff_t
386 {
return (__lhs.get() - __rhs); }
388 template<
typename _Up>
389 inline friend std::ptrdiff_t
391 {
return (__lhs - __rhs.get()); }
393 template<
typename _Up>
394 inline std::ptrdiff_t
396 {
return (_Storage_policy::get() - __rhs.get()); }
405 #define _CXX_POINTER_ARITH_OPERATOR_SET(INT_TYPE) \ 406 inline friend _Pointer_adapter \ 407 operator+(const _Pointer_adapter& __lhs, INT_TYPE __offset) \ 408 { return _Pointer_adapter(__lhs.get() + __offset); } \ 410 inline friend _Pointer_adapter \ 411 operator+(INT_TYPE __offset, const _Pointer_adapter& __rhs) \ 412 { return _Pointer_adapter(__rhs.get() + __offset); } \ 414 inline friend _Pointer_adapter \ 415 operator-(const _Pointer_adapter& __lhs, INT_TYPE __offset) \ 416 { return _Pointer_adapter(__lhs.get() - __offset); } \ 418 inline _Pointer_adapter& \ 419 operator+=(INT_TYPE __offset) \ 421 _Storage_policy::set(_Storage_policy::get() + __offset); \ 425 inline _Pointer_adapter& \ 426 operator-=(INT_TYPE __offset) \ 428 _Storage_policy::set(_Storage_policy::get() - __offset); \ 431 // END of _CXX_POINTER_ARITH_OPERATOR_SET macro 434 _CXX_POINTER_ARITH_OPERATOR_SET(
short);
435 _CXX_POINTER_ARITH_OPERATOR_SET(
unsigned short);
436 _CXX_POINTER_ARITH_OPERATOR_SET(
int);
437 _CXX_POINTER_ARITH_OPERATOR_SET(
unsigned int);
438 _CXX_POINTER_ARITH_OPERATOR_SET(
long);
439 _CXX_POINTER_ARITH_OPERATOR_SET(
unsigned long);
440 #ifdef _GLIBCXX_USE_LONG_LONG 441 _CXX_POINTER_ARITH_OPERATOR_SET(
long long);
442 _CXX_POINTER_ARITH_OPERATOR_SET(
unsigned long long);
449 _Storage_policy::set(_Storage_policy::get() + 1);
457 _Storage_policy::set(_Storage_policy::get() + 1);
464 _Storage_policy::set(_Storage_policy::get() - 1);
472 _Storage_policy::set(_Storage_policy::get() - 1);
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>
564 const _Pointer_adapter<_StoreT>& __p)
565 {
return (__os << __p.get()); }
567 _GLIBCXX_END_NAMESPACE_VERSION
570 #if __cplusplus >= 201103L 571 namespace std _GLIBCXX_VISIBILITY(default)
573 _GLIBCXX_BEGIN_NAMESPACE_VERSION
575 template<
typename _Storage_policy>
576 struct pointer_traits<
__gnu_cxx::_Pointer_adapter<_Storage_policy>>
585 template<
typename _Up>
587 typename pointer_traits<_Storage_policy>::template rebind<_Up>>;
589 static pointer pointer_to(
typename pointer::reference __r) noexcept
593 _GLIBCXX_END_NAMESPACE_VERSION
A storage policy for use with _Pointer_adapter<> which yields a standard pointer.
__detected_or_t< ptrdiff_t, __difference_type, _Ptr > difference_type
The type used to represent the difference between two pointers.
GNU extensions for public use.
_GLIBCXX17_CONSTEXPR _Tp * addressof(_Tp &__r) noexcept
Returns the actual address of the object or function referenced by r, even in the presence of an over...
ISO C++ entities toplevel namespace is std.
__detected_or_t< __get_first_arg_t< _Ptr >, __element_type, _Ptr > element_type
The type pointed to.
Template class basic_ostream.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
typename __rebind< _Ptr, _Up >::type rebind
A pointer to a different type.
Random-access iterators support a superset of bidirectional iterator operations.
A storage policy for use with _Pointer_adapter<> which stores the pointer's address as an offset valu...
_Ptr pointer
The pointer type.