30#ifndef _GLIBCXX_EXPERIMENTAL_PROPAGATE_CONST
31#define _GLIBCXX_EXPERIMENTAL_PROPAGATE_CONST 1
33#pragma GCC system_header
35#if __cplusplus >= 201402L
43namespace std _GLIBCXX_VISIBILITY(default)
45_GLIBCXX_BEGIN_NAMESPACE_VERSION
49inline namespace fundamentals_v2
63 template <
typename _Tp>
70 template <
typename _Up>
74 template <
typename _Up>
75 struct __is_propagate_const<propagate_const<_Up>> :
true_type
78 template <
typename _Up>
79 friend constexpr const _Up&
80 get_underlying(
const propagate_const<_Up>& __pt)
noexcept;
81 template <
typename _Up>
83 get_underlying(propagate_const<_Up>& __pt)
noexcept;
85 template <
typename _Up>
86 static constexpr element_type*
87 __to_raw_pointer(_Up* __u)
90 template <
typename _Up>
91 static constexpr element_type*
92 __to_raw_pointer(_Up& __u)
95 template <
typename _Up>
96 static constexpr const element_type*
97 __to_raw_pointer(
const _Up* __u)
100 template <
typename _Up>
101 static constexpr const element_type*
102 __to_raw_pointer(
const _Up& __u)
103 {
return __u.get(); }
106 static_assert(__and_<is_object<typename remove_pointer<_Tp>::type>,
107 __not_<is_array<_Tp>>,
109 "propagate_const requires a class or a pointer to an"
113 constexpr propagate_const() =
default;
114 propagate_const(
const propagate_const& __p) =
delete;
115 constexpr propagate_const(propagate_const&& __p) =
default;
117 template <
typename _Up,
typename
121 constexpr propagate_const(propagate_const<_Up>&& __pu)
125 template <
typename _Up,
typename
127 __not_<is_convertible<_Up&&, _Tp>>>::value,
129 constexpr explicit propagate_const(propagate_const<_Up>&& __pu)
133 template <
typename _Up,
typename
136 __not_<__is_propagate_const<
137 typename decay<_Up>::type>>
138 >::value,
bool>
::type=
true>
139 constexpr propagate_const(_Up&& __u)
143 template <
typename _Up,
typename
145 __not_<is_convertible<_Up&&, _Tp>>,
146 __not_<__is_propagate_const<
147 typename decay<_Up>::type>>
148 >::value,
bool>
::type=
false>
149 constexpr explicit propagate_const(_Up&& __u)
154 propagate_const& operator=(
const propagate_const& __p) =
delete;
155 constexpr propagate_const& operator=(propagate_const&& __p) =
default;
157 template <
typename _Up,
typename =
159 constexpr propagate_const& operator=(propagate_const<_Up>&& __pu)
165 template <
typename _Up,
typename =
167 __not_<__is_propagate_const<
168 typename decay<_Up>::type>>
170 constexpr propagate_const& operator=(_Up&& __u)
177 explicit constexpr operator bool()
const
182 constexpr const element_type* operator->()
const
187 template <
typename _Up = _Tp,
191 >::value,
bool>
::type =
true>
192 constexpr operator const element_type*()
const
197 constexpr const element_type& operator*()
const
202 constexpr const element_type* get()
const
204 return __to_raw_pointer(_M_t);
208 constexpr element_type* operator->()
213 template <
typename _Up = _Tp,
217 >::value,
bool>
::type =
true>
218 constexpr operator element_type*()
223 constexpr element_type& operator*()
228 constexpr element_type* get()
230 return __to_raw_pointer(_M_t);
235 swap(propagate_const& __pt)
noexcept(__is_nothrow_swappable<_Tp>::value)
238 swap(_M_t, get_underlying(__pt));
246 template <
typename _Tp>
250 return get_underlying(__pt) ==
nullptr;
253 template <
typename _Tp>
257 return nullptr == get_underlying(__pu);
260 template <
typename _Tp>
262 operator!=(
const propagate_const<_Tp>& __pt, nullptr_t)
264 return get_underlying(__pt) !=
nullptr;
267 template <
typename _Tp>
268 constexpr bool operator!=(nullptr_t,
const propagate_const<_Tp>& __pu)
270 return nullptr != get_underlying(__pu);
273 template <
typename _Tp,
typename _Up>
278 return get_underlying(__pt) == get_underlying(__pu);
281 template <
typename _Tp,
typename _Up>
286 return get_underlying(__pt) != get_underlying(__pu);
289 template <
typename _Tp,
typename _Up>
294 return get_underlying(__pt) < get_underlying(__pu);
297 template <
typename _Tp,
typename _Up>
302 return get_underlying(__pt) > get_underlying(__pu);
305 template <
typename _Tp,
typename _Up>
310 return get_underlying(__pt) <= get_underlying(__pu);
313 template <
typename _Tp,
typename _Up>
318 return get_underlying(__pt) >= get_underlying(__pu);
321 template <
typename _Tp,
typename _Up>
325 return get_underlying(__pt) == __u;
328 template <
typename _Tp,
typename _Up>
332 return get_underlying(__pt) != __u;
335 template <
typename _Tp,
typename _Up>
339 return get_underlying(__pt) < __u;
342 template <
typename _Tp,
typename _Up>
346 return get_underlying(__pt) > __u;
349 template <
typename _Tp,
typename _Up>
353 return get_underlying(__pt) <= __u;
356 template <
typename _Tp,
typename _Up>
360 return get_underlying(__pt) >= __u;
363 template <
typename _Tp,
typename _Up>
367 return __t == get_underlying(__pu);
370 template <
typename _Tp,
typename _Up>
374 return __t != get_underlying(__pu);
377 template <
typename _Tp,
typename _Up>
381 return __t < get_underlying(__pu);
384 template <
typename _Tp,
typename _Up>
388 return __t > get_underlying(__pu);
391 template <
typename _Tp,
typename _Up>
395 return __t <= get_underlying(__pu);
398 template <
typename _Tp,
typename _Up>
402 return __t >= get_underlying(__pu);
408 template <
typename _Tp>
409 constexpr enable_if_t<__is_swappable<_Tp>::value,
void>
411 noexcept(__is_nothrow_swappable<_Tp>::value)
417 template <
typename _Tp>
424 template <
typename _Tp>
436 template <
typename _Tp>
439 using result_type = size_t;
440 using argument_type = experimental::propagate_const<_Tp>;
443 operator()(
const experimental::propagate_const<_Tp>& __t)
const
444 noexcept(
noexcept(hash<_Tp>{}(get_underlying(__t))))
446 return hash<_Tp>{}(get_underlying(__t));
451 template <
typename _Tp>
455 operator()(
const experimental::propagate_const<_Tp>& __x,
456 const experimental::propagate_const<_Tp>& __y)
const
458 return equal_to<_Tp>{}(get_underlying(__x), get_underlying(__y));
466 template <
typename _Tp>
470 operator()(
const experimental::propagate_const<_Tp>& __x,
471 const experimental::propagate_const<_Tp>& __y)
const
473 return not_equal_to<_Tp>{}(get_underlying(__x), get_underlying(__y));
481 template <
typename _Tp>
485 operator()(
const experimental::propagate_const<_Tp>& __x,
486 const experimental::propagate_const<_Tp>& __y)
const
488 return less<_Tp>{}(get_underlying(__x), get_underlying(__y));
496 template <
typename _Tp>
500 operator()(
const experimental::propagate_const<_Tp>& __x,
501 const experimental::propagate_const<_Tp>& __y)
const
503 return greater<_Tp>{}(get_underlying(__x), get_underlying(__y));
511 template <
typename _Tp>
515 operator()(
const experimental::propagate_const<_Tp>& __x,
516 const experimental::propagate_const<_Tp>& __y)
const
518 return less_equal<_Tp>{}(get_underlying(__x), get_underlying(__y));
526 template <
typename _Tp>
530 operator()(
const experimental::propagate_const<_Tp>& __x,
531 const experimental::propagate_const<_Tp>& __y)
const
533 return greater_equal<_Tp>{}(get_underlying(__x), get_underlying(__y));
541_GLIBCXX_END_NAMESPACE_VERSION
typename remove_reference< _Tp >::type remove_reference_t
Alias template for remove_reference.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
integral_constant< bool, 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.
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
ISO C++ entities toplevel namespace is std.
Namespace for features defined in ISO Technical Specifications.
Primary class template hash.
Define a member typedef type only if a boolean constant is true.
One of the comparison functors.
One of the comparison functors.
One of the comparison functors.
One of the comparison functors.
One of the comparison functors.
One of the comparison functors.
Const-propagating wrapper.