30#ifndef _GLIBCXX_EXPERIMENTAL_PROPAGATE_CONST
31#define _GLIBCXX_EXPERIMENTAL_PROPAGATE_CONST 1
34#pragma GCC system_header
39#if __cplusplus >= 201402L
47namespace std _GLIBCXX_VISIBILITY(default)
49_GLIBCXX_BEGIN_NAMESPACE_VERSION
53inline namespace fundamentals_v2
55 template<
typename _Tp>
56 using __propagate_const_elem_type
57 = remove_reference_t<decltype(*std::declval<_Tp&>())>;
59 template<
typename _Tp,
60 typename _Elem = __propagate_const_elem_type<_Tp>,
61 bool = is_convertible<const _Tp, const _Elem*>::value>
62 struct __propagate_const_conversion_c
65 template<
typename _Tp,
typename _Elem>
66 struct __propagate_const_conversion_c<_Tp, _Elem, true>
68 constexpr operator const _Elem*()
const;
71 template<
typename _Tp,
72 typename _Elem = __propagate_const_elem_type<_Tp>,
73 bool = is_convertible<_Tp, _Elem*>::value>
74 struct __propagate_const_conversion_nc
77 template<
typename _Tp,
typename _Elem>
78 struct __propagate_const_conversion_nc<_Tp, _Elem, true>
80 constexpr operator _Elem*();
84 template <
typename _Tp>
85 struct __propagate_const_conversions
86 : __propagate_const_conversion_c<_Tp>, __propagate_const_conversion_nc<_Tp>
90 template<
typename _Tp>
91 struct __propagate_const_conversions<_Tp*>
93 constexpr operator const _Tp*()
const noexcept;
94 constexpr operator _Tp*()
noexcept;
109 template <
typename _Tp>
113 using element_type = __propagate_const_elem_type<_Tp>;
116 template <
typename _Up>
120 template <
typename _Up>
124 template <
typename _Up>
125 friend constexpr const _Up&
127 template <
typename _Up>
128 friend constexpr _Up&
131 template <
typename _Up>
132 static constexpr element_type*
133 __to_raw_pointer(_Up* __u)
136 template <
typename _Up>
137 static constexpr element_type*
138 __to_raw_pointer(_Up& __u)
139 {
return __u.get(); }
141 template <
typename _Up>
142 static constexpr const element_type*
143 __to_raw_pointer(
const _Up* __u)
146 template <
typename _Up>
147 static constexpr const element_type*
148 __to_raw_pointer(
const _Up& __u)
149 {
return __u.get(); }
152 static_assert(__and_<is_object<typename remove_pointer<_Tp>::type>,
153 __not_<is_array<_Tp>>,
155 "propagate_const requires a class or a pointer to an"
163 template <
typename _Up,
typename
171 template <
typename _Up,
typename
173 __not_<is_convertible<_Up&&, _Tp>>>::value,
179 template <
typename _Up,
typename
182 __not_<__is_propagate_const<
183 typename decay<_Up>::type>>
184 >::value,
bool>::type=
true>
186 : _M_t(std::forward<_Up>(__u))
189 template <
typename _Up,
typename
191 __not_<is_convertible<_Up&&, _Tp>>,
192 __not_<__is_propagate_const<
193 typename decay<_Up>::type>>
194 >::value,
bool>::type=
false>
196 : _M_t(std::forward<_Up>(__u))
203 template <
typename _Up,
typename =
211 template <
typename _Up,
typename =
213 __not_<__is_propagate_const<
214 typename decay<_Up>::type>>
218 _M_t = std::forward<_Up>(__u);
223 explicit constexpr operator bool()
const
228 constexpr const element_type* operator->()
const
233 constexpr const element_type& operator*()
const
238 constexpr const element_type* get()
const
240 return __to_raw_pointer(_M_t);
244 constexpr element_type* operator->()
249 constexpr element_type& operator*()
254 constexpr element_type* get()
256 return __to_raw_pointer(_M_t);
261 swap(
propagate_const& __pt)
noexcept(__is_nothrow_swappable<_Tp>::value)
264 swap(_M_t, get_underlying(__pt));
272 template <
typename _Tp>
276 return get_underlying(__pt) ==
nullptr;
279 template <
typename _Tp>
283 return nullptr == get_underlying(__pu);
286 template <
typename _Tp>
288 operator!=(
const propagate_const<_Tp>& __pt, nullptr_t)
290 return get_underlying(__pt) !=
nullptr;
293 template <
typename _Tp>
294 constexpr bool operator!=(nullptr_t,
const propagate_const<_Tp>& __pu)
296 return nullptr != get_underlying(__pu);
299 template <
typename _Tp,
typename _Up>
301 operator==(
const propagate_const<_Tp>& __pt,
302 const propagate_const<_Up>& __pu)
304 return get_underlying(__pt) == get_underlying(__pu);
307 template <
typename _Tp,
typename _Up>
309 operator!=(
const propagate_const<_Tp>& __pt,
310 const propagate_const<_Up>& __pu)
312 return get_underlying(__pt) != get_underlying(__pu);
315 template <
typename _Tp,
typename _Up>
317 operator<(
const propagate_const<_Tp>& __pt,
318 const propagate_const<_Up>& __pu)
320 return get_underlying(__pt) < get_underlying(__pu);
323 template <
typename _Tp,
typename _Up>
325 operator>(
const propagate_const<_Tp>& __pt,
326 const propagate_const<_Up>& __pu)
328 return get_underlying(__pt) > get_underlying(__pu);
331 template <
typename _Tp,
typename _Up>
334 const propagate_const<_Up>& __pu)
336 return get_underlying(__pt) <= get_underlying(__pu);
339 template <
typename _Tp,
typename _Up>
342 const propagate_const<_Up>& __pu)
344 return get_underlying(__pt) >= get_underlying(__pu);
347 template <
typename _Tp,
typename _Up>
349 operator==(
const propagate_const<_Tp>& __pt,
const _Up& __u)
351 return get_underlying(__pt) == __u;
354 template <
typename _Tp,
typename _Up>
356 operator!=(
const propagate_const<_Tp>& __pt,
const _Up& __u)
358 return get_underlying(__pt) != __u;
361 template <
typename _Tp,
typename _Up>
363 operator<(
const propagate_const<_Tp>& __pt,
const _Up& __u)
365 return get_underlying(__pt) < __u;
368 template <
typename _Tp,
typename _Up>
370 operator>(
const propagate_const<_Tp>& __pt,
const _Up& __u)
372 return get_underlying(__pt) > __u;
375 template <
typename _Tp,
typename _Up>
377 operator<=(
const propagate_const<_Tp>& __pt,
const _Up& __u)
379 return get_underlying(__pt) <= __u;
382 template <
typename _Tp,
typename _Up>
384 operator>=(
const propagate_const<_Tp>& __pt,
const _Up& __u)
386 return get_underlying(__pt) >= __u;
389 template <
typename _Tp,
typename _Up>
391 operator==(
const _Tp& __t,
const propagate_const<_Up>& __pu)
393 return __t == get_underlying(__pu);
396 template <
typename _Tp,
typename _Up>
398 operator!=(
const _Tp& __t,
const propagate_const<_Up>& __pu)
400 return __t != get_underlying(__pu);
403 template <
typename _Tp,
typename _Up>
405 operator<(
const _Tp& __t,
const propagate_const<_Up>& __pu)
407 return __t < get_underlying(__pu);
410 template <
typename _Tp,
typename _Up>
412 operator>(
const _Tp& __t,
const propagate_const<_Up>& __pu)
414 return __t > get_underlying(__pu);
417 template <
typename _Tp,
typename _Up>
419 operator<=(
const _Tp& __t,
const propagate_const<_Up>& __pu)
421 return __t <= get_underlying(__pu);
424 template <
typename _Tp,
typename _Up>
426 operator>=(
const _Tp& __t,
const propagate_const<_Up>& __pu)
428 return __t >= get_underlying(__pu);
434 template <
typename _Tp>
435 constexpr enable_if_t<__is_swappable<_Tp>::value,
void>
436 swap(propagate_const<_Tp>& __pt, propagate_const<_Tp>& __pt2)
437 noexcept(__is_nothrow_swappable<_Tp>::value)
443 template <
typename _Tp>
445 get_underlying(
const propagate_const<_Tp>& __pt)
noexcept
450 template <
typename _Tp>
452 get_underlying(propagate_const<_Tp>& __pt)
noexcept
457 template<
typename _Tp>
459 __propagate_const_conversions<_Tp*>::operator
const _Tp*()
const noexcept
460 {
return static_cast<const propagate_const<_Tp*>*
>(
this)->get(); }
462 template<
typename _Tp>
464 __propagate_const_conversions<_Tp*>::operator _Tp*()
noexcept
465 {
return static_cast<propagate_const<_Tp*>*
>(
this)->get(); }
467 template<
typename _Tp,
typename _Elem>
469 __propagate_const_conversion_c<_Tp, _Elem, true>::
470 operator
const _Elem*()
const
471 {
return static_cast<const propagate_const<_Tp>*
>(
this)->get(); }
473 template<
typename _Tp,
typename _Elem>
475 __propagate_const_conversion_nc<_Tp, _Elem, true>::
477 {
return static_cast<propagate_const<_Tp>*
>(
this)->get(); }
484 template <
typename _Tp>
485 struct hash<experimental::propagate_const<_Tp>>
487 using result_type = size_t;
488 using argument_type = experimental::propagate_const<_Tp>;
491 operator()(
const experimental::propagate_const<_Tp>& __t)
const
492 noexcept(
noexcept(hash<_Tp>{}(get_underlying(__t))))
494 return hash<_Tp>{}(get_underlying(__t));
499 template <
typename _Tp>
500 struct equal_to<experimental::propagate_const<_Tp>>
503 operator()(
const experimental::propagate_const<_Tp>& __x,
504 const experimental::propagate_const<_Tp>& __y)
const
506 return equal_to<_Tp>{}(get_underlying(__x), get_underlying(__y));
514 template <
typename _Tp>
515 struct not_equal_to<experimental::propagate_const<_Tp>>
518 operator()(
const experimental::propagate_const<_Tp>& __x,
519 const experimental::propagate_const<_Tp>& __y)
const
521 return not_equal_to<_Tp>{}(get_underlying(__x), get_underlying(__y));
529 template <
typename _Tp>
530 struct less<experimental::propagate_const<_Tp>>
533 operator()(
const experimental::propagate_const<_Tp>& __x,
534 const experimental::propagate_const<_Tp>& __y)
const
536 return less<_Tp>{}(get_underlying(__x), get_underlying(__y));
544 template <
typename _Tp>
545 struct greater<experimental::propagate_const<_Tp>>
548 operator()(
const experimental::propagate_const<_Tp>& __x,
549 const experimental::propagate_const<_Tp>& __y)
const
551 return greater<_Tp>{}(get_underlying(__x), get_underlying(__y));
559 template <
typename _Tp>
560 struct less_equal<experimental::propagate_const<_Tp>>
563 operator()(
const experimental::propagate_const<_Tp>& __x,
564 const experimental::propagate_const<_Tp>& __y)
const
566 return less_equal<_Tp>{}(get_underlying(__x), get_underlying(__y));
574 template <
typename _Tp>
575 struct greater_equal<experimental::propagate_const<_Tp>>
578 operator()(
const experimental::propagate_const<_Tp>& __x,
579 const experimental::propagate_const<_Tp>& __y)
const
581 return greater_equal<_Tp>{}(get_underlying(__x), get_underlying(__y));
589_GLIBCXX_END_NAMESPACE_VERSION
constexpr bool operator<=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator>=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator<(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator>(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
ISO C++ entities toplevel namespace is std.
Define a member typedef type only if a boolean constant is true.
bool result_type
result_type is the return type
_Tp second_argument_type
second_argument_type is the type of the second argument
_Tp first_argument_type
first_argument_type is the type of the first argument
Const-propagating wrapper.