30 #ifndef _GLIBCXX_EXPERIMENTAL_PROPAGATE_CONST 31 #define _GLIBCXX_EXPERIMENTAL_PROPAGATE_CONST 1 33 #pragma GCC system_header 35 #if __cplusplus >= 201402L 43 namespace std _GLIBCXX_VISIBILITY(default)
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
47 namespace experimental
49 inline 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&
81 template <
typename _Up>
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>,
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;
116 template <
typename _Up,
typename 123 template <
typename _Up,
typename 124 enable_if<__and_<is_constructible<_Tp, _Up&&>,
125 __not_<is_convertible<_Up&&, _Tp>>>::value,
130 template <
typename _Up,
typename 131 enable_if<__and_<is_constructible<_Tp, _Up&&>,
133 __not_<__is_propagate_const<
134 typename decay<_Up>::type>>
135 >::value,
bool>::type=
true>
136 constexpr propagate_const(_Up&& __u)
137 : _M_t(std::forward<_Up>(__u))
139 template <
typename _Up,
typename 140 enable_if<__and_<is_constructible<_Tp, _Up&&>,
141 __not_<is_convertible<_Up&&, _Tp>>,
142 __not_<__is_propagate_const<
143 typename decay<_Up>::type>>
144 >::value,
bool>::type=
false>
145 constexpr
explicit propagate_const(_Up&& __u)
146 : _M_t(std::forward<_Up>(__u))
150 propagate_const& operator=(
const propagate_const& __p) =
delete;
151 constexpr propagate_const& operator=(propagate_const&& __p) =
default;
153 template <
typename _Up,
typename =
161 template <
typename _Up,
typename =
163 __not_<__is_propagate_const<
164 typename decay<_Up>::type>>
166 constexpr propagate_const& operator=(_Up&& __u)
168 _M_t = std::forward<_Up>(__u);
173 explicit constexpr
operator bool()
const 178 constexpr
const element_type* operator->()
const 183 template <
typename _Up = _Tp,
187 >::value,
bool>::type =
true>
188 constexpr
operator const element_type*()
const 193 constexpr
const element_type&
operator*()
const 198 constexpr
const element_type*
get()
const 200 return __to_raw_pointer(_M_t);
204 constexpr element_type* operator->()
209 template <
typename _Up = _Tp,
210 typename enable_if<__or_<is_pointer<_Up>,
213 >::value,
bool>::type =
true>
214 constexpr
operator element_type*()
224 constexpr element_type*
get()
226 return __to_raw_pointer(_M_t);
231 swap(propagate_const& __pt) noexcept(__is_nothrow_swappable<_Tp>::value)
234 swap(_M_t, get_underlying(__pt));
242 template <
typename _Tp>
246 return get_underlying(__pt) ==
nullptr;
249 template <
typename _Tp>
253 return nullptr == get_underlying(__pu);
256 template <
typename _Tp>
260 return get_underlying(__pt) !=
nullptr;
263 template <
typename _Tp>
266 return nullptr != get_underlying(__pu);
269 template <
typename _Tp,
typename _Up>
274 return get_underlying(__pt) == get_underlying(__pu);
277 template <
typename _Tp,
typename _Up>
282 return get_underlying(__pt) != get_underlying(__pu);
285 template <
typename _Tp,
typename _Up>
287 operator<(const propagate_const<_Tp>& __pt,
290 return get_underlying(__pt) < get_underlying(__pu);
293 template <
typename _Tp,
typename _Up>
298 return get_underlying(__pt) > get_underlying(__pu);
301 template <
typename _Tp,
typename _Up>
303 operator<=(const propagate_const<_Tp>& __pt,
306 return get_underlying(__pt) <= get_underlying(__pu);
309 template <
typename _Tp,
typename _Up>
314 return get_underlying(__pt) >= get_underlying(__pu);
317 template <
typename _Tp,
typename _Up>
321 return get_underlying(__pt) == __u;
324 template <
typename _Tp,
typename _Up>
328 return get_underlying(__pt) != __u;
331 template <
typename _Tp,
typename _Up>
333 operator<(const propagate_const<_Tp>& __pt,
const _Up& __u)
335 return get_underlying(__pt) < __u;
338 template <
typename _Tp,
typename _Up>
342 return get_underlying(__pt) > __u;
345 template <
typename _Tp,
typename _Up>
347 operator<=(const propagate_const<_Tp>& __pt,
const _Up& __u)
349 return get_underlying(__pt) <= __u;
352 template <
typename _Tp,
typename _Up>
356 return get_underlying(__pt) >= __u;
359 template <
typename _Tp,
typename _Up>
363 return __t == get_underlying(__pu);
366 template <
typename _Tp,
typename _Up>
370 return __t != get_underlying(__pu);
373 template <
typename _Tp,
typename _Up>
375 operator<(const _Tp& __t, const propagate_const<_Up>& __pu)
377 return __t < get_underlying(__pu);
380 template <
typename _Tp,
typename _Up>
384 return __t > get_underlying(__pu);
387 template <
typename _Tp,
typename _Up>
389 operator<=(const _Tp& __t, const propagate_const<_Up>& __pu)
391 return __t <= get_underlying(__pu);
394 template <
typename _Tp,
typename _Up>
398 return __t >= get_underlying(__pu);
402 template <
typename _Tp>
405 noexcept(__is_nothrow_swappable<_Tp>::value)
411 template <
typename _Tp>
418 template <
typename _Tp>
430 template <
typename _Tp>
433 using result_type = size_t;
434 using argument_type = experimental::propagate_const<_Tp>;
437 operator()(
const experimental::propagate_const<_Tp>& __t)
const 438 noexcept(noexcept(
hash<_Tp>{}(get_underlying(__t))))
445 template <
typename _Tp>
449 operator()(
const experimental::propagate_const<_Tp>& __x,
450 const experimental::propagate_const<_Tp>& __y)
const 452 return equal_to<_Tp>{}(get_underlying(__x), get_underlying(__y));
455 typedef experimental::propagate_const<_Tp> first_argument_type;
456 typedef experimental::propagate_const<_Tp> second_argument_type;
457 typedef bool result_type;
460 template <
typename _Tp>
464 operator()(
const experimental::propagate_const<_Tp>& __x,
465 const experimental::propagate_const<_Tp>& __y)
const 470 typedef experimental::propagate_const<_Tp> first_argument_type;
471 typedef experimental::propagate_const<_Tp> second_argument_type;
472 typedef bool result_type;
475 template <
typename _Tp>
479 operator()(
const experimental::propagate_const<_Tp>& __x,
480 const experimental::propagate_const<_Tp>& __y)
const 482 return less<_Tp>{}(get_underlying(__x), get_underlying(__y));
485 typedef experimental::propagate_const<_Tp> first_argument_type;
486 typedef experimental::propagate_const<_Tp> second_argument_type;
487 typedef bool result_type;
490 template <
typename _Tp>
494 operator()(
const experimental::propagate_const<_Tp>& __x,
495 const experimental::propagate_const<_Tp>& __y)
const 497 return greater<_Tp>{}(get_underlying(__x), get_underlying(__y));
500 typedef experimental::propagate_const<_Tp> first_argument_type;
501 typedef experimental::propagate_const<_Tp> second_argument_type;
502 typedef bool result_type;
505 template <
typename _Tp>
509 operator()(
const experimental::propagate_const<_Tp>& __x,
510 const experimental::propagate_const<_Tp>& __y)
const 515 typedef experimental::propagate_const<_Tp> first_argument_type;
516 typedef experimental::propagate_const<_Tp> second_argument_type;
517 typedef bool result_type;
520 template <
typename _Tp>
524 operator()(
const experimental::propagate_const<_Tp>& __x,
525 const experimental::propagate_const<_Tp>& __y)
const 530 typedef experimental::propagate_const<_Tp> first_argument_type;
531 typedef experimental::propagate_const<_Tp> second_argument_type;
532 typedef bool result_type;
535 _GLIBCXX_END_NAMESPACE_VERSION
540 #endif // _GLIBCXX_EXPERIMENTAL_PROPAGATE_CONST One of the comparison functors.
One of the comparison functors.
constexpr complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
One of the comparison functors.
Const-propagating wrapper.
typename remove_reference< _Tp >::type remove_reference_t
Alias template for remove_reference.
Define a member typedef type only if a boolean constant is true.
Primary class template hash.
One of the comparison functors.
ISO C++ entities toplevel namespace is std.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
One of the comparison functors.
One of the comparison functors.