| 1 |
// -*- C++ -*- |
| 2 |
//===----------------------------------------------------------------------===// |
| 3 |
// |
| 4 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 |
// See https://llvm.org/LICENSE.txt for license information. |
| 6 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 |
// |
| 8 |
//===----------------------------------------------------------------------===// |
| 9 |
|
| 10 |
#ifndef _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST |
| 11 |
#define _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST |
| 12 |
|
| 13 |
/* |
| 14 |
propagate_const synopsis |
| 15 |
|
| 16 |
namespace std { namespace experimental { inline namespace fundamentals_v2 { |
| 17 |
|
| 18 |
// [propagate_const] |
| 19 |
template <class T> class propagate_const; |
| 20 |
|
| 21 |
// [propagate_const.underlying], underlying pointer access |
| 22 |
constexpr const _Tp& _VSTD_LFTS_V2::get_underlying(const propagate_const<T>& pt) noexcept; |
| 23 |
constexpr T& _VSTD_LFTS_V2::get_underlying(propagate_const<T>& pt) noexcept; |
| 24 |
|
| 25 |
// [propagate_const.relational], relational operators |
| 26 |
template <class T> constexpr bool operator==(const propagate_const<T>& pt, nullptr_t); |
| 27 |
template <class T> constexpr bool operator==(nullptr_t, const propagate_const<T>& pu); |
| 28 |
template <class T> constexpr bool operator!=(const propagate_const<T>& pt, nullptr_t); |
| 29 |
template <class T> constexpr bool operator!=(nullptr_t, const propagate_const<T>& pu); |
| 30 |
template <class T, class U> constexpr bool operator==(const propagate_const<T>& pt, const propagate_const<_Up>& pu); |
| 31 |
template <class T, class U> constexpr bool operator!=(const propagate_const<T>& pt, const propagate_const<_Up>& pu); |
| 32 |
template <class T, class U> constexpr bool operator<(const propagate_const<T>& pt, const propagate_const<_Up>& pu); |
| 33 |
template <class T, class U> constexpr bool operator>(const propagate_const<T>& pt, const propagate_const<_Up>& pu); |
| 34 |
template <class T, class U> constexpr bool operator<=(const propagate_const<T>& pt, const propagate_const<_Up>& pu); |
| 35 |
template <class T, class U> constexpr bool operator>=(const propagate_const<T>& pt, const propagate_const<_Up>& pu); |
| 36 |
template <class T, class U> constexpr bool operator==(const propagate_const<T>& pt, const _Up& u); |
| 37 |
template <class T, class U> constexpr bool operator!=(const propagate_const<T>& pt, const _Up& u); |
| 38 |
template <class T, class U> constexpr bool operator<(const propagate_const<T>& pt, const _Up& u); |
| 39 |
template <class T, class U> constexpr bool operator>(const propagate_const<T>& pt, const _Up& u); |
| 40 |
template <class T, class U> constexpr bool operator<=(const propagate_const<T>& pt, const _Up& u); |
| 41 |
template <class T, class U> constexpr bool operator>=(const propagate_const<T>& pt, const _Up& u); |
| 42 |
template <class T, class U> constexpr bool operator==(const _Tp& t, const propagate_const<_Up>& pu); |
| 43 |
template <class T, class U> constexpr bool operator!=(const _Tp& t, const propagate_const<_Up>& pu); |
| 44 |
template <class T, class U> constexpr bool operator<(const _Tp& t, const propagate_const<_Up>& pu); |
| 45 |
template <class T, class U> constexpr bool operator>(const _Tp& t, const propagate_const<_Up>& pu); |
| 46 |
template <class T, class U> constexpr bool operator<=(const _Tp& t, const propagate_const<_Up>& pu); |
| 47 |
template <class T, class U> constexpr bool operator>=(const _Tp& t, const propagate_const<_Up>& pu); |
| 48 |
|
| 49 |
// [propagate_const.algorithms], specialized algorithms |
| 50 |
template <class T> constexpr void swap(propagate_const<T>& pt, propagate_const<T>& pu) noexcept(see below); |
| 51 |
|
| 52 |
template <class T> |
| 53 |
class propagate_const |
| 54 |
{ |
| 55 |
|
| 56 |
public: |
| 57 |
typedef remove_reference_t<decltype(*declval<T&>())> element_type; |
| 58 |
|
| 59 |
// [propagate_const.ctor], constructors |
| 60 |
constexpr propagate_const() = default; |
| 61 |
propagate_const(const propagate_const& p) = delete; |
| 62 |
constexpr propagate_const(propagate_const&& p) = default; |
| 63 |
template <class U> EXPLICIT constexpr propagate_const(propagate_const<_Up>&& pu); // see below |
| 64 |
template <class U> EXPLICIT constexpr propagate_const(U&& u); // see below |
| 65 |
|
| 66 |
// [propagate_const.assignment], assignment |
| 67 |
propagate_const& operator=(const propagate_const& p) = delete; |
| 68 |
constexpr propagate_const& operator=(propagate_const&& p) = default; |
| 69 |
template <class U> constexpr propagate_const& operator=(propagate_const<_Up>&& pu); |
| 70 |
template <class U> constexpr propagate_const& operator=(U&& u); // see below |
| 71 |
|
| 72 |
// [propagate_const.const_observers], const observers |
| 73 |
explicit constexpr operator bool() const; |
| 74 |
constexpr const element_type* operator->() const; |
| 75 |
constexpr operator const element_type*() const; // Not always defined |
| 76 |
constexpr const element_type& operator*() const; |
| 77 |
constexpr const element_type* get() const; |
| 78 |
|
| 79 |
// [propagate_const.non_const_observers], non-const observers |
| 80 |
constexpr element_type* operator->(); |
| 81 |
constexpr operator element_type*(); // Not always defined |
| 82 |
constexpr element_type& operator*(); |
| 83 |
constexpr element_type* get(); |
| 84 |
|
| 85 |
// [propagate_const.modifiers], modifiers |
| 86 |
constexpr void swap(propagate_const& pt) noexcept(see below) |
| 87 |
|
| 88 |
private: |
| 89 |
T t_; // exposition only |
| 90 |
}; |
| 91 |
|
| 92 |
} // namespace fundamentals_v2 |
| 93 |
} // namespace experimental |
| 94 |
|
| 95 |
// [propagate_const.hash], hash support |
| 96 |
template <class T> struct hash<experimental::fundamentals_v2::propagate_const<T>>; |
| 97 |
|
| 98 |
// [propagate_const.comparison_function_objects], comparison function objects |
| 99 |
template <class T> struct equal_to<experimental::fundamentals_v2::propagate_const<T>>; |
| 100 |
template <class T> struct not_equal_to<experimental::fundamentals_v2::propagate_const<T>>; |
| 101 |
template <class T> struct less<experimental::fundamentals_v2::propagate_const<T>>; |
| 102 |
template <class T> struct greater<experimental::fundamentals_v2::propagate_const<T>>; |
| 103 |
template <class T> struct less_equal<experimental::fundamentals_v2::propagate_const<T>>; |
| 104 |
template <class T> struct greater_equal<experimental::fundamentals_v2::propagate_const<T>>; |
| 105 |
|
| 106 |
} // namespace std |
| 107 |
|
| 108 |
*/ |
| 109 |
|
| 110 |
#include <__assert> // all public C++ headers provide the assertion handler |
| 111 |
#include <__functional/operations.h> |
| 112 |
#include <__fwd/hash.h> |
| 113 |
#include <__utility/forward.h> |
| 114 |
#include <__utility/move.h> |
| 115 |
#include <__utility/swap.h> |
| 116 |
#include <experimental/__config> |
| 117 |
#include <type_traits> |
| 118 |
|
| 119 |
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 120 |
# pragma GCC system_header |
| 121 |
#endif |
| 122 |
|
| 123 |
#if _LIBCPP_STD_VER > 11 |
| 124 |
|
| 125 |
_LIBCPP_BEGIN_NAMESPACE_LFTS_V2 |
| 126 |
|
| 127 |
template <class _Tp> |
| 128 |
class propagate_const; |
| 129 |
|
| 130 |
template <class _Up> |
| 131 |
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR |
| 132 |
const _Up& get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT; |
| 133 |
|
| 134 |
template <class _Up> |
| 135 |
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR |
| 136 |
_Up& get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT; |
| 137 |
|
| 138 |
template <class _Tp> |
| 139 |
class propagate_const |
| 140 |
{ |
| 141 |
public: |
| 142 |
typedef remove_reference_t<decltype(*std::declval<_Tp&>())> element_type; |
| 143 |
|
| 144 |
static_assert(!is_array<_Tp>::value, |
| 145 |
"Instantiation of propagate_const with an array type is ill-formed."); |
| 146 |
static_assert(!is_reference<_Tp>::value, |
| 147 |
"Instantiation of propagate_const with a reference type is ill-formed."); |
| 148 |
static_assert(!(is_pointer<_Tp>::value && is_function<__remove_pointer_t<_Tp> >::value), |
| 149 |
"Instantiation of propagate_const with a function-pointer type is ill-formed."); |
| 150 |
static_assert(!(is_pointer<_Tp>::value && is_same<__remove_cv_t<__remove_pointer_t<_Tp> >, void>::value), |
| 151 |
"Instantiation of propagate_const with a pointer to (possibly cv-qualified) void is ill-formed."); |
| 152 |
|
| 153 |
private: |
| 154 |
template <class _Up> |
| 155 |
static _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up* __u) |
| 156 |
{ |
| 157 |
return __u; |
| 158 |
} |
| 159 |
|
| 160 |
template <class _Up> |
| 161 |
static _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up& __u) |
| 162 |
{ |
| 163 |
return __get_pointer(__u.get()); |
| 164 |
} |
| 165 |
|
| 166 |
template <class _Up> |
| 167 |
static _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up* __u) |
| 168 |
{ |
| 169 |
return __u; |
| 170 |
} |
| 171 |
|
| 172 |
template <class _Up> |
| 173 |
static _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up& __u) |
| 174 |
{ |
| 175 |
return __get_pointer(__u.get()); |
| 176 |
} |
| 177 |
|
| 178 |
template <class _Up> |
| 179 |
struct __is_propagate_const : false_type |
| 180 |
{ |
| 181 |
}; |
| 182 |
|
| 183 |
template <class _Up> |
| 184 |
struct __is_propagate_const<propagate_const<_Up>> : true_type |
| 185 |
{ |
| 186 |
}; |
| 187 |
|
| 188 |
_Tp __t_; |
| 189 |
|
| 190 |
public: |
| 191 |
|
| 192 |
template <class _Up> friend _LIBCPP_CONSTEXPR const _Up& ::_VSTD_LFTS_V2::get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT; |
| 193 |
template <class _Up> friend _LIBCPP_CONSTEXPR _Up& ::_VSTD_LFTS_V2::get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT; |
| 194 |
|
| 195 |
_LIBCPP_CONSTEXPR propagate_const() = default; |
| 196 |
|
| 197 |
propagate_const(const propagate_const&) = delete; |
| 198 |
|
| 199 |
_LIBCPP_CONSTEXPR propagate_const(propagate_const&&) = default; |
| 200 |
|
| 201 |
template <class _Up, enable_if_t<!is_convertible<_Up, _Tp>::value && |
| 202 |
is_constructible<_Tp, _Up&&>::value,bool> = true> |
| 203 |
explicit _LIBCPP_CONSTEXPR propagate_const(propagate_const<_Up>&& __pu) |
| 204 |
: __t_(std::move(_VSTD_LFTS_V2::get_underlying(__pu))) |
| 205 |
{ |
| 206 |
} |
| 207 |
|
| 208 |
template <class _Up, enable_if_t<is_convertible<_Up&&, _Tp>::value && |
| 209 |
is_constructible<_Tp, _Up&&>::value,bool> = false> |
| 210 |
_LIBCPP_CONSTEXPR propagate_const(propagate_const<_Up>&& __pu) |
| 211 |
: __t_(std::move(_VSTD_LFTS_V2::get_underlying(__pu))) |
| 212 |
{ |
| 213 |
} |
| 214 |
|
| 215 |
template <class _Up, enable_if_t<!is_convertible<_Up&&, _Tp>::value && |
| 216 |
is_constructible<_Tp, _Up&&>::value && |
| 217 |
!__is_propagate_const<decay_t<_Up>>::value,bool> = true> |
| 218 |
explicit _LIBCPP_CONSTEXPR propagate_const(_Up&& __u) |
| 219 |
: __t_(std::forward<_Up>(__u)) |
| 220 |
{ |
| 221 |
} |
| 222 |
|
| 223 |
template <class _Up, enable_if_t<is_convertible<_Up&&, _Tp>::value && |
| 224 |
is_constructible<_Tp, _Up&&>::value && |
| 225 |
!__is_propagate_const<decay_t<_Up>>::value,bool> = false> |
| 226 |
_LIBCPP_CONSTEXPR propagate_const(_Up&& __u) |
| 227 |
: __t_(std::forward<_Up>(__u)) |
| 228 |
{ |
| 229 |
} |
| 230 |
|
| 231 |
propagate_const& operator=(const propagate_const&) = delete; |
| 232 |
|
| 233 |
_LIBCPP_CONSTEXPR propagate_const& operator=(propagate_const&&) = default; |
| 234 |
|
| 235 |
template <class _Up> |
| 236 |
_LIBCPP_CONSTEXPR propagate_const& operator=(propagate_const<_Up>&& __pu) |
| 237 |
{ |
| 238 |
__t_ = std::move(_VSTD_LFTS_V2::get_underlying(__pu)); |
| 239 |
return *this; |
| 240 |
} |
| 241 |
|
| 242 |
template <class _Up, class _Vp = enable_if_t<!__is_propagate_const<decay_t<_Up>>::value>> |
| 243 |
_LIBCPP_CONSTEXPR propagate_const& operator=(_Up&& __u) |
| 244 |
{ |
| 245 |
__t_ = std::forward<_Up>(__u); |
| 246 |
return *this; |
| 247 |
} |
| 248 |
|
| 249 |
_LIBCPP_CONSTEXPR const element_type* get() const |
| 250 |
{ |
| 251 |
return __get_pointer(__t_); |
| 252 |
} |
| 253 |
|
| 254 |
_LIBCPP_CONSTEXPR element_type* get() |
| 255 |
{ |
| 256 |
return __get_pointer(__t_); |
| 257 |
} |
| 258 |
|
| 259 |
explicit _LIBCPP_CONSTEXPR operator bool() const |
| 260 |
{ |
| 261 |
return get() != nullptr; |
| 262 |
} |
| 263 |
|
| 264 |
_LIBCPP_CONSTEXPR const element_type* operator->() const |
| 265 |
{ |
| 266 |
return get(); |
| 267 |
} |
| 268 |
|
| 269 |
template <class _Tp_ = _Tp, class _Up = enable_if_t<is_convertible< |
| 270 |
const _Tp_, const element_type *>::value>> |
| 271 |
_LIBCPP_CONSTEXPR operator const element_type *() const { |
| 272 |
return get(); |
| 273 |
} |
| 274 |
|
| 275 |
_LIBCPP_CONSTEXPR const element_type& operator*() const |
| 276 |
{ |
| 277 |
return *get(); |
| 278 |
} |
| 279 |
|
| 280 |
_LIBCPP_CONSTEXPR element_type* operator->() |
| 281 |
{ |
| 282 |
return get(); |
| 283 |
} |
| 284 |
|
| 285 |
template <class _Tp_ = _Tp, class _Up = enable_if_t< |
| 286 |
is_convertible<_Tp_, element_type *>::value>> |
| 287 |
_LIBCPP_CONSTEXPR operator element_type *() { |
| 288 |
return get(); |
| 289 |
} |
| 290 |
|
| 291 |
_LIBCPP_CONSTEXPR element_type& operator*() |
| 292 |
{ |
| 293 |
return *get(); |
| 294 |
} |
| 295 |
|
| 296 |
_LIBCPP_CONSTEXPR void swap(propagate_const& __pt) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) |
| 297 |
{ |
| 298 |
using _VSTD::swap; |
| 299 |
swap(__t_, __pt.__t_); |
| 300 |
} |
| 301 |
}; |
| 302 |
|
| 303 |
|
| 304 |
template <class _Tp> |
| 305 |
_LIBCPP_INLINE_VISIBILITY |
| 306 |
_LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, nullptr_t) |
| 307 |
{ |
| 308 |
return _VSTD_LFTS_V2::get_underlying(__pt) == nullptr; |
| 309 |
} |
| 310 |
|
| 311 |
template <class _Tp> |
| 312 |
_LIBCPP_INLINE_VISIBILITY |
| 313 |
_LIBCPP_CONSTEXPR bool operator==(nullptr_t, const propagate_const<_Tp>& __pt) |
| 314 |
{ |
| 315 |
return nullptr == _VSTD_LFTS_V2::get_underlying(__pt); |
| 316 |
} |
| 317 |
|
| 318 |
template <class _Tp> |
| 319 |
_LIBCPP_INLINE_VISIBILITY |
| 320 |
_LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, nullptr_t) |
| 321 |
{ |
| 322 |
return _VSTD_LFTS_V2::get_underlying(__pt) != nullptr; |
| 323 |
} |
| 324 |
|
| 325 |
template <class _Tp> |
| 326 |
_LIBCPP_INLINE_VISIBILITY |
| 327 |
_LIBCPP_CONSTEXPR bool operator!=(nullptr_t, const propagate_const<_Tp>& __pt) |
| 328 |
{ |
| 329 |
return nullptr != _VSTD_LFTS_V2::get_underlying(__pt); |
| 330 |
} |
| 331 |
|
| 332 |
template <class _Tp, class _Up> |
| 333 |
_LIBCPP_INLINE_VISIBILITY |
| 334 |
_LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, |
| 335 |
const propagate_const<_Up>& __pu) |
| 336 |
{ |
| 337 |
return _VSTD_LFTS_V2::get_underlying(__pt) == _VSTD_LFTS_V2::get_underlying(__pu); |
| 338 |
} |
| 339 |
|
| 340 |
template <class _Tp, class _Up> |
| 341 |
_LIBCPP_INLINE_VISIBILITY |
| 342 |
_LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, |
| 343 |
const propagate_const<_Up>& __pu) |
| 344 |
{ |
| 345 |
return _VSTD_LFTS_V2::get_underlying(__pt) != _VSTD_LFTS_V2::get_underlying(__pu); |
| 346 |
} |
| 347 |
|
| 348 |
template <class _Tp, class _Up> |
| 349 |
_LIBCPP_INLINE_VISIBILITY |
| 350 |
_LIBCPP_CONSTEXPR bool operator<(const propagate_const<_Tp>& __pt, |
| 351 |
const propagate_const<_Up>& __pu) |
| 352 |
{ |
| 353 |
return _VSTD_LFTS_V2::get_underlying(__pt) < _VSTD_LFTS_V2::get_underlying(__pu); |
| 354 |
} |
| 355 |
|
| 356 |
template <class _Tp, class _Up> |
| 357 |
_LIBCPP_INLINE_VISIBILITY |
| 358 |
_LIBCPP_CONSTEXPR bool operator>(const propagate_const<_Tp>& __pt, |
| 359 |
const propagate_const<_Up>& __pu) |
| 360 |
{ |
| 361 |
return _VSTD_LFTS_V2::get_underlying(__pt) > _VSTD_LFTS_V2::get_underlying(__pu); |
| 362 |
} |
| 363 |
|
| 364 |
template <class _Tp, class _Up> |
| 365 |
_LIBCPP_INLINE_VISIBILITY |
| 366 |
_LIBCPP_CONSTEXPR bool operator<=(const propagate_const<_Tp>& __pt, |
| 367 |
const propagate_const<_Up>& __pu) |
| 368 |
{ |
| 369 |
return _VSTD_LFTS_V2::get_underlying(__pt) <= _VSTD_LFTS_V2::get_underlying(__pu); |
| 370 |
} |
| 371 |
|
| 372 |
template <class _Tp, class _Up> |
| 373 |
_LIBCPP_INLINE_VISIBILITY |
| 374 |
_LIBCPP_CONSTEXPR bool operator>=(const propagate_const<_Tp>& __pt, |
| 375 |
const propagate_const<_Up>& __pu) |
| 376 |
{ |
| 377 |
return _VSTD_LFTS_V2::get_underlying(__pt) >= _VSTD_LFTS_V2::get_underlying(__pu); |
| 378 |
} |
| 379 |
|
| 380 |
template <class _Tp, class _Up> |
| 381 |
_LIBCPP_INLINE_VISIBILITY |
| 382 |
_LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, const _Up& __u) |
| 383 |
{ |
| 384 |
return _VSTD_LFTS_V2::get_underlying(__pt) == __u; |
| 385 |
} |
| 386 |
|
| 387 |
template <class _Tp, class _Up> |
| 388 |
_LIBCPP_INLINE_VISIBILITY |
| 389 |
_LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, const _Up& __u) |
| 390 |
{ |
| 391 |
return _VSTD_LFTS_V2::get_underlying(__pt) != __u; |
| 392 |
} |
| 393 |
|
| 394 |
template <class _Tp, class _Up> |
| 395 |
_LIBCPP_INLINE_VISIBILITY |
| 396 |
_LIBCPP_CONSTEXPR bool operator<(const propagate_const<_Tp>& __pt, const _Up& __u) |
| 397 |
{ |
| 398 |
return _VSTD_LFTS_V2::get_underlying(__pt) < __u; |
| 399 |
} |
| 400 |
|
| 401 |
template <class _Tp, class _Up> |
| 402 |
_LIBCPP_INLINE_VISIBILITY |
| 403 |
_LIBCPP_CONSTEXPR bool operator>(const propagate_const<_Tp>& __pt, const _Up& __u) |
| 404 |
{ |
| 405 |
return _VSTD_LFTS_V2::get_underlying(__pt) > __u; |
| 406 |
} |
| 407 |
|
| 408 |
template <class _Tp, class _Up> |
| 409 |
_LIBCPP_INLINE_VISIBILITY |
| 410 |
_LIBCPP_CONSTEXPR bool operator<=(const propagate_const<_Tp>& __pt, const _Up& __u) |
| 411 |
{ |
| 412 |
return _VSTD_LFTS_V2::get_underlying(__pt) <= __u; |
| 413 |
} |
| 414 |
|
| 415 |
template <class _Tp, class _Up> |
| 416 |
_LIBCPP_INLINE_VISIBILITY |
| 417 |
_LIBCPP_CONSTEXPR bool operator>=(const propagate_const<_Tp>& __pt, const _Up& __u) |
| 418 |
{ |
| 419 |
return _VSTD_LFTS_V2::get_underlying(__pt) >= __u; |
| 420 |
} |
| 421 |
|
| 422 |
|
| 423 |
template <class _Tp, class _Up> |
| 424 |
_LIBCPP_INLINE_VISIBILITY |
| 425 |
_LIBCPP_CONSTEXPR bool operator==(const _Tp& __t, const propagate_const<_Up>& __pu) |
| 426 |
{ |
| 427 |
return __t == _VSTD_LFTS_V2::get_underlying(__pu); |
| 428 |
} |
| 429 |
|
| 430 |
template <class _Tp, class _Up> |
| 431 |
_LIBCPP_INLINE_VISIBILITY |
| 432 |
_LIBCPP_CONSTEXPR bool operator!=(const _Tp& __t, const propagate_const<_Up>& __pu) |
| 433 |
{ |
| 434 |
return __t != _VSTD_LFTS_V2::get_underlying(__pu); |
| 435 |
} |
| 436 |
|
| 437 |
template <class _Tp, class _Up> |
| 438 |
_LIBCPP_INLINE_VISIBILITY |
| 439 |
_LIBCPP_CONSTEXPR bool operator<(const _Tp& __t, const propagate_const<_Up>& __pu) |
| 440 |
{ |
| 441 |
return __t < _VSTD_LFTS_V2::get_underlying(__pu); |
| 442 |
} |
| 443 |
|
| 444 |
template <class _Tp, class _Up> |
| 445 |
_LIBCPP_INLINE_VISIBILITY |
| 446 |
_LIBCPP_CONSTEXPR bool operator>(const _Tp& __t, const propagate_const<_Up>& __pu) |
| 447 |
{ |
| 448 |
return __t > _VSTD_LFTS_V2::get_underlying(__pu); |
| 449 |
} |
| 450 |
|
| 451 |
template <class _Tp, class _Up> |
| 452 |
_LIBCPP_INLINE_VISIBILITY |
| 453 |
_LIBCPP_CONSTEXPR bool operator<=(const _Tp& __t, const propagate_const<_Up>& __pu) |
| 454 |
{ |
| 455 |
return __t <= _VSTD_LFTS_V2::get_underlying(__pu); |
| 456 |
} |
| 457 |
|
| 458 |
template <class _Tp, class _Up> |
| 459 |
_LIBCPP_INLINE_VISIBILITY |
| 460 |
_LIBCPP_CONSTEXPR bool operator>=(const _Tp& __t, const propagate_const<_Up>& __pu) |
| 461 |
{ |
| 462 |
return __t >= _VSTD_LFTS_V2::get_underlying(__pu); |
| 463 |
} |
| 464 |
|
| 465 |
template <class _Tp> |
| 466 |
_LIBCPP_INLINE_VISIBILITY |
| 467 |
_LIBCPP_CONSTEXPR void swap(propagate_const<_Tp>& __pc1, propagate_const<_Tp>& __pc2) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) |
| 468 |
{ |
| 469 |
__pc1.swap(__pc2); |
| 470 |
} |
| 471 |
|
| 472 |
template <class _Tp> |
| 473 |
_LIBCPP_CONSTEXPR const _Tp& get_underlying(const propagate_const<_Tp>& __pt) _NOEXCEPT |
| 474 |
{ |
| 475 |
return __pt.__t_; |
| 476 |
} |
| 477 |
|
| 478 |
template <class _Tp> |
| 479 |
_LIBCPP_CONSTEXPR _Tp& get_underlying(propagate_const<_Tp>& __pt) _NOEXCEPT |
| 480 |
{ |
| 481 |
return __pt.__t_; |
| 482 |
} |
| 483 |
|
| 484 |
_LIBCPP_END_NAMESPACE_LFTS_V2 |
| 485 |
|
| 486 |
_LIBCPP_BEGIN_NAMESPACE_STD |
| 487 |
|
| 488 |
template <class _Tp> |
| 489 |
struct hash<experimental::fundamentals_v2::propagate_const<_Tp>> |
| 490 |
{ |
| 491 |
typedef size_t result_type; |
| 492 |
typedef experimental::fundamentals_v2::propagate_const<_Tp> argument_type; |
| 493 |
|
| 494 |
size_t operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1) const |
| 495 |
{ |
| 496 |
return std::hash<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1)); |
| 497 |
} |
| 498 |
}; |
| 499 |
|
| 500 |
template <class _Tp> |
| 501 |
struct equal_to<experimental::fundamentals_v2::propagate_const<_Tp>> |
| 502 |
{ |
| 503 |
typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type; |
| 504 |
typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type; |
| 505 |
|
| 506 |
bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1, |
| 507 |
const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const |
| 508 |
{ |
| 509 |
return std::equal_to<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2)); |
| 510 |
} |
| 511 |
}; |
| 512 |
|
| 513 |
template <class _Tp> |
| 514 |
struct not_equal_to<experimental::fundamentals_v2::propagate_const<_Tp>> |
| 515 |
{ |
| 516 |
typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type; |
| 517 |
typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type; |
| 518 |
|
| 519 |
bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1, |
| 520 |
const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const |
| 521 |
{ |
| 522 |
return std::not_equal_to<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2)); |
| 523 |
} |
| 524 |
}; |
| 525 |
|
| 526 |
template <class _Tp> |
| 527 |
struct less<experimental::fundamentals_v2::propagate_const<_Tp>> |
| 528 |
{ |
| 529 |
typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type; |
| 530 |
typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type; |
| 531 |
|
| 532 |
bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1, |
| 533 |
const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const |
| 534 |
{ |
| 535 |
return std::less<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2)); |
| 536 |
} |
| 537 |
}; |
| 538 |
|
| 539 |
template <class _Tp> |
| 540 |
struct greater<experimental::fundamentals_v2::propagate_const<_Tp>> |
| 541 |
{ |
| 542 |
typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type; |
| 543 |
typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type; |
| 544 |
|
| 545 |
bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1, |
| 546 |
const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const |
| 547 |
{ |
| 548 |
return std::greater<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2)); |
| 549 |
} |
| 550 |
}; |
| 551 |
|
| 552 |
template <class _Tp> |
| 553 |
struct less_equal<experimental::fundamentals_v2::propagate_const<_Tp>> |
| 554 |
{ |
| 555 |
typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type; |
| 556 |
typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type; |
| 557 |
|
| 558 |
bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1, |
| 559 |
const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const |
| 560 |
{ |
| 561 |
return std::less_equal<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2)); |
| 562 |
} |
| 563 |
}; |
| 564 |
|
| 565 |
template <class _Tp> |
| 566 |
struct greater_equal<experimental::fundamentals_v2::propagate_const<_Tp>> |
| 567 |
{ |
| 568 |
typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type; |
| 569 |
typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type; |
| 570 |
|
| 571 |
bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1, |
| 572 |
const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const |
| 573 |
{ |
| 574 |
return std::greater_equal<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2)); |
| 575 |
} |
| 576 |
}; |
| 577 |
|
| 578 |
_LIBCPP_END_NAMESPACE_STD |
| 579 |
|
| 580 |
#endif // _LIBCPP_STD_VER > 11 |
| 581 |
#endif // _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST |