39#pragma GCC system_header
45#if __cplusplus >= 201103L
49#if __cplusplus > 201703L
53namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
55_GLIBCXX_BEGIN_NAMESPACE_VERSION
68 template<
typename _Tp>
73 typedef _Tp element_type;
82 set(element_type* __arg)
88 {
return (_M_value < __rarg._M_value); }
92 {
return (_M_value == __rarg._M_value); }
95 element_type* _M_value;
111 template<
typename _Tp>
115 typedef _Tp element_type;
123 return reinterpret_cast<_Tp*
>(
reinterpret_cast<uintptr_t
>(
this)
133 _M_diff =
reinterpret_cast<uintptr_t
>(__arg)
134 -
reinterpret_cast<uintptr_t
>(
this);
140 {
return (
reinterpret_cast<uintptr_t
>(this->get())
141 <
reinterpret_cast<uintptr_t
>(__rarg.get())); }
145 {
return (
reinterpret_cast<uintptr_t
>(this->get())
146 ==
reinterpret_cast<uintptr_t
>(__rarg.get())); }
149 typedef __UINTPTR_TYPE__ uintptr_t;
157 template<
typename _Tp>
161 typedef const _Tp element_type;
169 return reinterpret_cast<const _Tp*
>
170 (
reinterpret_cast<uintptr_t
>(
this) + _M_diff);
174 set(
const _Tp* __arg)
179 _M_diff =
reinterpret_cast<uintptr_t
>(__arg)
180 -
reinterpret_cast<uintptr_t
>(
this);
186 {
return (
reinterpret_cast<uintptr_t
>(this->get())
187 <
reinterpret_cast<uintptr_t
>(__rarg.get())); }
191 {
return (
reinterpret_cast<uintptr_t
>(this->get())
192 ==
reinterpret_cast<uintptr_t
>(__rarg.get())); }
195 typedef __UINTPTR_TYPE__ uintptr_t;
206 template<
typename _Tp>
207 struct _Reference_type
208 {
typedef _Tp& reference; };
211 struct _Reference_type<void>
212 {
typedef _Invalid_type& reference; };
215 struct _Reference_type<const void>
216 {
typedef const _Invalid_type& reference; };
219 struct _Reference_type<volatile void>
220 {
typedef volatile _Invalid_type& reference; };
223 struct _Reference_type<volatile const void>
224 {
typedef const volatile _Invalid_type& reference; };
231 template<
typename _Tp>
233 {
typedef _Tp type; };
235 template<
typename _Tp>
237 {
typedef _Tp type; };
271 template<
typename _Storage_policy>
275 typedef typename _Storage_policy::element_type element_type;
279 typedef typename _Unqualified_type<element_type>::type value_type;
280 typedef std::ptrdiff_t difference_type;
282 typedef typename _Reference_type<element_type>::reference reference;
290 { _Storage_policy::set(__arg); }
294 { _Storage_policy::set(__arg.get()); }
297 template<
typename _Up>
299 { _Storage_policy::set(__arg); }
303 template<
typename _Up>
305 { _Storage_policy::set(__arg.get()); }
314 _Storage_policy::set(__arg.get());
318 template<
typename _Up>
322 _Storage_policy::set(__arg.get());
326 template<
typename _Up>
328 operator=(_Up* __arg)
330 _Storage_policy::set(__arg);
337 {
return *(_Storage_policy::get()); }
342 {
return _Storage_policy::get(); }
346 operator[](std::ptrdiff_t __index)
const
347 {
return _Storage_policy::get()[__index]; }
350#if __cplusplus >= 201103L
351 explicit operator bool()
const {
return _Storage_policy::get() != 0; }
357 operator __unspecified_bool_type()
const
359 return _Storage_policy::get() == 0 ? 0 :
360 &_Pointer_adapter::operator->;
366 {
return (_Storage_policy::get() == 0); }
370 inline friend std::ptrdiff_t
372 {
return (__lhs.get() - __rhs); }
374 inline friend std::ptrdiff_t
376 {
return (__lhs - __rhs.get()); }
378 template<
typename _Up>
379 inline friend std::ptrdiff_t
381 {
return (__lhs.get() - __rhs); }
383 template<
typename _Up>
384 inline friend std::ptrdiff_t
386 {
return (__lhs - __rhs.get()); }
388 template<
typename _Up>
389 inline std::ptrdiff_t
391 {
return (_Storage_policy::get() - __rhs.get()); }
400#define _CXX_POINTER_ARITH_OPERATOR_SET(INT_TYPE) \
401 inline friend _Pointer_adapter \
402 operator+(const _Pointer_adapter& __lhs, INT_TYPE __offset) \
403 { return _Pointer_adapter(__lhs.get() + __offset); } \
405 inline friend _Pointer_adapter \
406 operator+(INT_TYPE __offset, const _Pointer_adapter& __rhs) \
407 { return _Pointer_adapter(__rhs.get() + __offset); } \
409 inline friend _Pointer_adapter \
410 operator-(const _Pointer_adapter& __lhs, INT_TYPE __offset) \
411 { return _Pointer_adapter(__lhs.get() - __offset); } \
413 inline _Pointer_adapter& \
414 operator+=(INT_TYPE __offset) \
416 _Storage_policy::set(_Storage_policy::get() + __offset); \
420 inline _Pointer_adapter& \
421 operator-=(INT_TYPE __offset) \
423 _Storage_policy::set(_Storage_policy::get() - __offset); \
429 _CXX_POINTER_ARITH_OPERATOR_SET(
short);
430 _CXX_POINTER_ARITH_OPERATOR_SET(
unsigned short);
431 _CXX_POINTER_ARITH_OPERATOR_SET(
int);
432 _CXX_POINTER_ARITH_OPERATOR_SET(
unsigned int);
433 _CXX_POINTER_ARITH_OPERATOR_SET(
long);
434 _CXX_POINTER_ARITH_OPERATOR_SET(
unsigned long);
435#ifdef _GLIBCXX_USE_LONG_LONG
436 _CXX_POINTER_ARITH_OPERATOR_SET(
long long);
437 _CXX_POINTER_ARITH_OPERATOR_SET(
unsigned long long);
444 _Storage_policy::set(_Storage_policy::get() + 1);
452 _Storage_policy::set(_Storage_policy::get() + 1);
459 _Storage_policy::set(_Storage_policy::get() - 1);
467 _Storage_policy::set(_Storage_policy::get() - 1);
471#if __cpp_lib_three_way_comparison
472 friend std::strong_ordering
475 {
return __lhs.get() <=> __rhs.get(); }
480#define _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(OPERATOR) \
481 template<typename _Tp1, typename _Tp2> \
483 operator OPERATOR(const _Pointer_adapter<_Tp1>& __lhs, _Tp2 __rhs) \
484 { return __lhs.get() OPERATOR __rhs; } \
486 template<typename _Tp1, typename _Tp2> \
488 operator OPERATOR(_Tp1 __lhs, const _Pointer_adapter<_Tp2>& __rhs) \
489 { return __lhs OPERATOR __rhs.get(); } \
491 template<typename _Tp1, typename _Tp2> \
493 operator OPERATOR(const _Pointer_adapter<_Tp1>& __lhs, \
494 const _Pointer_adapter<_Tp2>& __rhs) \
495 { return __lhs.get() OPERATOR __rhs.get(); } \
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(>)
505 _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(>=)
508 template<typename _Tp>
511 {
return __lhs.get() ==
reinterpret_cast<void*
>(__rhs); }
513 template<
typename _Tp>
515 operator==(
int __lhs,
const _Pointer_adapter<_Tp>& __rhs)
516 {
return __rhs.get() ==
reinterpret_cast<void*
>(__lhs); }
518 template<
typename _Tp>
520 operator!=(
const _Pointer_adapter<_Tp>& __lhs,
int __rhs)
521 {
return __lhs.get() !=
reinterpret_cast<void*
>(__rhs); }
523 template<
typename _Tp>
525 operator!=(
int __lhs,
const _Pointer_adapter<_Tp>& __rhs)
526 {
return __rhs.get() !=
reinterpret_cast<void*
>(__lhs); }
532 template<
typename _Tp>
536 {
return __lhs._Tp::operator==(__rhs); }
538 template<
typename _Tp>
540 operator<=(
const _Pointer_adapter<_Tp>& __lhs,
541 const _Pointer_adapter<_Tp>& __rhs)
542 {
return __lhs._Tp::operator<(__rhs) || __lhs._Tp::operator==(__rhs); }
544 template<
typename _Tp>
546 operator!=(
const _Pointer_adapter<_Tp>& __lhs,
547 const _Pointer_adapter<_Tp>& __rhs)
548 {
return !(__lhs._Tp::operator==(__rhs)); }
550 template<
typename _Tp>
552 operator>(
const _Pointer_adapter<_Tp>& __lhs,
553 const _Pointer_adapter<_Tp>& __rhs)
554 {
return !(__lhs._Tp::operator<(__rhs) || __lhs._Tp::operator==(__rhs)); }
556 template<
typename _Tp>
558 operator>=(
const _Pointer_adapter<_Tp>& __lhs,
559 const _Pointer_adapter<_Tp>& __rhs)
560 {
return !(__lhs._Tp::operator<(__rhs)); }
562 template<
typename _CharT,
typename _Traits,
typename _StoreT>
565 const _Pointer_adapter<_StoreT>& __p)
566 {
return (__os << __p.get()); }
568_GLIBCXX_END_NAMESPACE_VERSION
571#if __cplusplus >= 201103L
572namespace std _GLIBCXX_VISIBILITY(default)
574_GLIBCXX_BEGIN_NAMESPACE_VERSION
576 template<
typename _Storage_policy>
577 struct pointer_traits<
__gnu_cxx::_Pointer_adapter<_Storage_policy>>
582 typedef typename pointer::element_type element_type;
584 typedef typename pointer::difference_type difference_type;
586 template<
typename _Up>
588 typename pointer_traits<_Storage_policy>::template rebind<_Up>>;
590 static pointer pointer_to(
typename pointer::reference __r)
noexcept
594#if __cpp_lib_concepts
595 template<
typename _Policy>
596 struct indirectly_readable_traits<
__gnu_cxx::_Pointer_adapter<_Policy>>
599 =
typename __gnu_cxx::_Pointer_adapter<_Policy>::value_type;
602_GLIBCXX_END_NAMESPACE_VERSION
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.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
GNU extensions for public use.
Template class basic_ostream.
Random-access iterators support a superset of bidirectional iterator operations.
A storage policy for use with _Pointer_adapter<> which yields a standard pointer.
A storage policy for use with _Pointer_adapter<> which stores the pointer's address as an offset valu...