propagate_const 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  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. #ifndef _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST
  10. #define _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST
  11. /*
  12. propagate_const synopsis
  13. namespace std { namespace experimental { inline namespace fundamentals_v2 {
  14. // [propagate_const]
  15. template <class T> class propagate_const;
  16. // [propagate_const.underlying], underlying pointer access
  17. constexpr const _Tp& _VSTD_LFTS_V2::get_underlying(const propagate_const<T>& pt) noexcept;
  18. constexpr T& _VSTD_LFTS_V2::get_underlying(propagate_const<T>& pt) noexcept;
  19. // [propagate_const.relational], relational operators
  20. template <class T> constexpr bool operator==(const propagate_const<T>& pt, nullptr_t);
  21. template <class T> constexpr bool operator==(nullptr_t, const propagate_const<T>& pu);
  22. template <class T> constexpr bool operator!=(const propagate_const<T>& pt, nullptr_t);
  23. template <class T> constexpr bool operator!=(nullptr_t, const propagate_const<T>& pu);
  24. template <class T, class U> constexpr bool operator==(const propagate_const<T>& pt, const propagate_const<_Up>& pu);
  25. template <class T, class U> constexpr bool operator!=(const propagate_const<T>& pt, const propagate_const<_Up>& pu);
  26. template <class T, class U> constexpr bool operator<(const propagate_const<T>& pt, const propagate_const<_Up>& pu);
  27. template <class T, class U> constexpr bool operator>(const propagate_const<T>& pt, const propagate_const<_Up>& pu);
  28. template <class T, class U> constexpr bool operator<=(const propagate_const<T>& pt, const propagate_const<_Up>& pu);
  29. template <class T, class U> constexpr bool operator>=(const propagate_const<T>& pt, const propagate_const<_Up>& pu);
  30. template <class T, class U> constexpr bool operator==(const propagate_const<T>& pt, const _Up& u);
  31. template <class T, class U> constexpr bool operator!=(const propagate_const<T>& pt, const _Up& u);
  32. template <class T, class U> constexpr bool operator<(const propagate_const<T>& pt, const _Up& u);
  33. template <class T, class U> constexpr bool operator>(const propagate_const<T>& pt, const _Up& u);
  34. template <class T, class U> constexpr bool operator<=(const propagate_const<T>& pt, const _Up& u);
  35. template <class T, class U> constexpr bool operator>=(const propagate_const<T>& pt, const _Up& u);
  36. template <class T, class U> constexpr bool operator==(const _Tp& t, const propagate_const<_Up>& pu);
  37. template <class T, class U> constexpr bool operator!=(const _Tp& t, const propagate_const<_Up>& pu);
  38. template <class T, class U> constexpr bool operator<(const _Tp& t, const propagate_const<_Up>& pu);
  39. template <class T, class U> constexpr bool operator>(const _Tp& t, const propagate_const<_Up>& pu);
  40. template <class T, class U> constexpr bool operator<=(const _Tp& t, const propagate_const<_Up>& pu);
  41. template <class T, class U> constexpr bool operator>=(const _Tp& t, const propagate_const<_Up>& pu);
  42. // [propagate_const.algorithms], specialized algorithms
  43. template <class T> constexpr void swap(propagate_const<T>& pt, propagate_const<T>& pu) noexcept(see below);
  44. template <class T>
  45. class propagate_const
  46. {
  47. public:
  48. typedef remove_reference_t<decltype(*declval<T&>())> element_type;
  49. // [propagate_const.ctor], constructors
  50. constexpr propagate_const() = default;
  51. propagate_const(const propagate_const& p) = delete;
  52. constexpr propagate_const(propagate_const&& p) = default;
  53. template <class U> EXPLICIT constexpr propagate_const(propagate_const<_Up>&& pu); // see below
  54. template <class U> EXPLICIT constexpr propagate_const(U&& u); // see below
  55. // [propagate_const.assignment], assignment
  56. propagate_const& operator=(const propagate_const& p) = delete;
  57. constexpr propagate_const& operator=(propagate_const&& p) = default;
  58. template <class U> constexpr propagate_const& operator=(propagate_const<_Up>&& pu);
  59. template <class U> constexpr propagate_const& operator=(U&& u); // see below
  60. // [propagate_const.const_observers], const observers
  61. explicit constexpr operator bool() const;
  62. constexpr const element_type* operator->() const;
  63. constexpr operator const element_type*() const; // Not always defined
  64. constexpr const element_type& operator*() const;
  65. constexpr const element_type* get() const;
  66. // [propagate_const.non_const_observers], non-const observers
  67. constexpr element_type* operator->();
  68. constexpr operator element_type*(); // Not always defined
  69. constexpr element_type& operator*();
  70. constexpr element_type* get();
  71. // [propagate_const.modifiers], modifiers
  72. constexpr void swap(propagate_const& pt) noexcept(see below)
  73. private:
  74. T t_; // exposition only
  75. };
  76. } // namespace fundamentals_v2
  77. } // namespace experimental
  78. // [propagate_const.hash], hash support
  79. template <class T> struct hash<experimental::fundamentals_v2::propagate_const<T>>;
  80. // [propagate_const.comparison_function_objects], comparison function objects
  81. template <class T> struct equal_to<experimental::fundamentals_v2::propagate_const<T>>;
  82. template <class T> struct not_equal_to<experimental::fundamentals_v2::propagate_const<T>>;
  83. template <class T> struct less<experimental::fundamentals_v2::propagate_const<T>>;
  84. template <class T> struct greater<experimental::fundamentals_v2::propagate_const<T>>;
  85. template <class T> struct less_equal<experimental::fundamentals_v2::propagate_const<T>>;
  86. template <class T> struct greater_equal<experimental::fundamentals_v2::propagate_const<T>>;
  87. } // namespace std
  88. */
  89. #include <experimental/__config>
  90. #include <functional>
  91. #include <type_traits>
  92. #include <utility>
  93. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  94. # pragma GCC system_header
  95. #endif
  96. #if _LIBCPP_STD_VER > 11
  97. _LIBCPP_BEGIN_NAMESPACE_LFTS_V2
  98. template <class _Tp>
  99. class propagate_const;
  100. template <class _Up>
  101. inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
  102. const _Up& get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
  103. template <class _Up>
  104. inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
  105. _Up& get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
  106. template <class _Tp>
  107. class propagate_const
  108. {
  109. public:
  110. typedef remove_reference_t<decltype(*declval<_Tp&>())> element_type;
  111. static_assert(!is_array<_Tp>::value,
  112. "Instantiation of propagate_const with an array type is ill-formed.");
  113. static_assert(!is_reference<_Tp>::value,
  114. "Instantiation of propagate_const with a reference type is ill-formed.");
  115. static_assert(!(is_pointer<_Tp>::value && is_function<typename remove_pointer<_Tp>::type>::value),
  116. "Instantiation of propagate_const with a function-pointer type is ill-formed.");
  117. static_assert(!(is_pointer<_Tp>::value && is_same<typename remove_cv<typename remove_pointer<_Tp>::type>::type, void>::value),
  118. "Instantiation of propagate_const with a pointer to (possibly cv-qualified) void is ill-formed.");
  119. private:
  120. template <class _Up>
  121. static _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up* __u)
  122. {
  123. return __u;
  124. }
  125. template <class _Up>
  126. static _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up& __u)
  127. {
  128. return __get_pointer(__u.get());
  129. }
  130. template <class _Up>
  131. static _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up* __u)
  132. {
  133. return __u;
  134. }
  135. template <class _Up>
  136. static _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up& __u)
  137. {
  138. return __get_pointer(__u.get());
  139. }
  140. template <class _Up>
  141. struct __is_propagate_const : false_type
  142. {
  143. };
  144. template <class _Up>
  145. struct __is_propagate_const<propagate_const<_Up>> : true_type
  146. {
  147. };
  148. _Tp __t_;
  149. public:
  150. template <class _Up> friend _LIBCPP_CONSTEXPR const _Up& ::_VSTD_LFTS_V2::get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
  151. template <class _Up> friend _LIBCPP_CONSTEXPR _Up& ::_VSTD_LFTS_V2::get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
  152. _LIBCPP_CONSTEXPR propagate_const() = default;
  153. propagate_const(const propagate_const&) = delete;
  154. _LIBCPP_CONSTEXPR propagate_const(propagate_const&&) = default;
  155. template <class _Up, enable_if_t<!is_convertible<_Up, _Tp>::value &&
  156. is_constructible<_Tp, _Up&&>::value,bool> = true>
  157. explicit _LIBCPP_CONSTEXPR propagate_const(propagate_const<_Up>&& __pu)
  158. : __t_(std::move(_VSTD_LFTS_V2::get_underlying(__pu)))
  159. {
  160. }
  161. template <class _Up, enable_if_t<is_convertible<_Up&&, _Tp>::value &&
  162. is_constructible<_Tp, _Up&&>::value,bool> = false>
  163. _LIBCPP_CONSTEXPR propagate_const(propagate_const<_Up>&& __pu)
  164. : __t_(std::move(_VSTD_LFTS_V2::get_underlying(__pu)))
  165. {
  166. }
  167. template <class _Up, enable_if_t<!is_convertible<_Up&&, _Tp>::value &&
  168. is_constructible<_Tp, _Up&&>::value &&
  169. !__is_propagate_const<decay_t<_Up>>::value,bool> = true>
  170. explicit _LIBCPP_CONSTEXPR propagate_const(_Up&& __u)
  171. : __t_(std::forward<_Up>(__u))
  172. {
  173. }
  174. template <class _Up, enable_if_t<is_convertible<_Up&&, _Tp>::value &&
  175. is_constructible<_Tp, _Up&&>::value &&
  176. !__is_propagate_const<decay_t<_Up>>::value,bool> = false>
  177. _LIBCPP_CONSTEXPR propagate_const(_Up&& __u)
  178. : __t_(std::forward<_Up>(__u))
  179. {
  180. }
  181. propagate_const& operator=(const propagate_const&) = delete;
  182. _LIBCPP_CONSTEXPR propagate_const& operator=(propagate_const&&) = default;
  183. template <class _Up>
  184. _LIBCPP_CONSTEXPR propagate_const& operator=(propagate_const<_Up>&& __pu)
  185. {
  186. __t_ = std::move(_VSTD_LFTS_V2::get_underlying(__pu));
  187. return *this;
  188. }
  189. template <class _Up, class _Vp = enable_if_t<!__is_propagate_const<decay_t<_Up>>::value>>
  190. _LIBCPP_CONSTEXPR propagate_const& operator=(_Up&& __u)
  191. {
  192. __t_ = std::forward<_Up>(__u);
  193. return *this;
  194. }
  195. _LIBCPP_CONSTEXPR const element_type* get() const
  196. {
  197. return __get_pointer(__t_);
  198. }
  199. _LIBCPP_CONSTEXPR element_type* get()
  200. {
  201. return __get_pointer(__t_);
  202. }
  203. explicit _LIBCPP_CONSTEXPR operator bool() const
  204. {
  205. return get() != nullptr;
  206. }
  207. _LIBCPP_CONSTEXPR const element_type* operator->() const
  208. {
  209. return get();
  210. }
  211. template <class _Tp_ = _Tp, class _Up = enable_if_t<is_convertible<
  212. const _Tp_, const element_type *>::value>>
  213. _LIBCPP_CONSTEXPR operator const element_type *() const {
  214. return get();
  215. }
  216. _LIBCPP_CONSTEXPR const element_type& operator*() const
  217. {
  218. return *get();
  219. }
  220. _LIBCPP_CONSTEXPR element_type* operator->()
  221. {
  222. return get();
  223. }
  224. template <class _Tp_ = _Tp, class _Up = enable_if_t<
  225. is_convertible<_Tp_, element_type *>::value>>
  226. _LIBCPP_CONSTEXPR operator element_type *() {
  227. return get();
  228. }
  229. _LIBCPP_CONSTEXPR element_type& operator*()
  230. {
  231. return *get();
  232. }
  233. _LIBCPP_CONSTEXPR void swap(propagate_const& __pt) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
  234. {
  235. using _VSTD::swap;
  236. swap(__t_, __pt.__t_);
  237. }
  238. };
  239. template <class _Tp>
  240. _LIBCPP_INLINE_VISIBILITY
  241. _LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, nullptr_t)
  242. {
  243. return _VSTD_LFTS_V2::get_underlying(__pt) == nullptr;
  244. }
  245. template <class _Tp>
  246. _LIBCPP_INLINE_VISIBILITY
  247. _LIBCPP_CONSTEXPR bool operator==(nullptr_t, const propagate_const<_Tp>& __pt)
  248. {
  249. return nullptr == _VSTD_LFTS_V2::get_underlying(__pt);
  250. }
  251. template <class _Tp>
  252. _LIBCPP_INLINE_VISIBILITY
  253. _LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, nullptr_t)
  254. {
  255. return _VSTD_LFTS_V2::get_underlying(__pt) != nullptr;
  256. }
  257. template <class _Tp>
  258. _LIBCPP_INLINE_VISIBILITY
  259. _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, const propagate_const<_Tp>& __pt)
  260. {
  261. return nullptr != _VSTD_LFTS_V2::get_underlying(__pt);
  262. }
  263. template <class _Tp, class _Up>
  264. _LIBCPP_INLINE_VISIBILITY
  265. _LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt,
  266. const propagate_const<_Up>& __pu)
  267. {
  268. return _VSTD_LFTS_V2::get_underlying(__pt) == _VSTD_LFTS_V2::get_underlying(__pu);
  269. }
  270. template <class _Tp, class _Up>
  271. _LIBCPP_INLINE_VISIBILITY
  272. _LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt,
  273. const propagate_const<_Up>& __pu)
  274. {
  275. return _VSTD_LFTS_V2::get_underlying(__pt) != _VSTD_LFTS_V2::get_underlying(__pu);
  276. }
  277. template <class _Tp, class _Up>
  278. _LIBCPP_INLINE_VISIBILITY
  279. _LIBCPP_CONSTEXPR bool operator<(const propagate_const<_Tp>& __pt,
  280. const propagate_const<_Up>& __pu)
  281. {
  282. return _VSTD_LFTS_V2::get_underlying(__pt) < _VSTD_LFTS_V2::get_underlying(__pu);
  283. }
  284. template <class _Tp, class _Up>
  285. _LIBCPP_INLINE_VISIBILITY
  286. _LIBCPP_CONSTEXPR bool operator>(const propagate_const<_Tp>& __pt,
  287. const propagate_const<_Up>& __pu)
  288. {
  289. return _VSTD_LFTS_V2::get_underlying(__pt) > _VSTD_LFTS_V2::get_underlying(__pu);
  290. }
  291. template <class _Tp, class _Up>
  292. _LIBCPP_INLINE_VISIBILITY
  293. _LIBCPP_CONSTEXPR bool operator<=(const propagate_const<_Tp>& __pt,
  294. const propagate_const<_Up>& __pu)
  295. {
  296. return _VSTD_LFTS_V2::get_underlying(__pt) <= _VSTD_LFTS_V2::get_underlying(__pu);
  297. }
  298. template <class _Tp, class _Up>
  299. _LIBCPP_INLINE_VISIBILITY
  300. _LIBCPP_CONSTEXPR bool operator>=(const propagate_const<_Tp>& __pt,
  301. const propagate_const<_Up>& __pu)
  302. {
  303. return _VSTD_LFTS_V2::get_underlying(__pt) >= _VSTD_LFTS_V2::get_underlying(__pu);
  304. }
  305. template <class _Tp, class _Up>
  306. _LIBCPP_INLINE_VISIBILITY
  307. _LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, const _Up& __u)
  308. {
  309. return _VSTD_LFTS_V2::get_underlying(__pt) == __u;
  310. }
  311. template <class _Tp, class _Up>
  312. _LIBCPP_INLINE_VISIBILITY
  313. _LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, const _Up& __u)
  314. {
  315. return _VSTD_LFTS_V2::get_underlying(__pt) != __u;
  316. }
  317. template <class _Tp, class _Up>
  318. _LIBCPP_INLINE_VISIBILITY
  319. _LIBCPP_CONSTEXPR bool operator<(const propagate_const<_Tp>& __pt, const _Up& __u)
  320. {
  321. return _VSTD_LFTS_V2::get_underlying(__pt) < __u;
  322. }
  323. template <class _Tp, class _Up>
  324. _LIBCPP_INLINE_VISIBILITY
  325. _LIBCPP_CONSTEXPR bool operator>(const propagate_const<_Tp>& __pt, const _Up& __u)
  326. {
  327. return _VSTD_LFTS_V2::get_underlying(__pt) > __u;
  328. }
  329. template <class _Tp, class _Up>
  330. _LIBCPP_INLINE_VISIBILITY
  331. _LIBCPP_CONSTEXPR bool operator<=(const propagate_const<_Tp>& __pt, const _Up& __u)
  332. {
  333. return _VSTD_LFTS_V2::get_underlying(__pt) <= __u;
  334. }
  335. template <class _Tp, class _Up>
  336. _LIBCPP_INLINE_VISIBILITY
  337. _LIBCPP_CONSTEXPR bool operator>=(const propagate_const<_Tp>& __pt, const _Up& __u)
  338. {
  339. return _VSTD_LFTS_V2::get_underlying(__pt) >= __u;
  340. }
  341. template <class _Tp, class _Up>
  342. _LIBCPP_INLINE_VISIBILITY
  343. _LIBCPP_CONSTEXPR bool operator==(const _Tp& __t, const propagate_const<_Up>& __pu)
  344. {
  345. return __t == _VSTD_LFTS_V2::get_underlying(__pu);
  346. }
  347. template <class _Tp, class _Up>
  348. _LIBCPP_INLINE_VISIBILITY
  349. _LIBCPP_CONSTEXPR bool operator!=(const _Tp& __t, const propagate_const<_Up>& __pu)
  350. {
  351. return __t != _VSTD_LFTS_V2::get_underlying(__pu);
  352. }
  353. template <class _Tp, class _Up>
  354. _LIBCPP_INLINE_VISIBILITY
  355. _LIBCPP_CONSTEXPR bool operator<(const _Tp& __t, const propagate_const<_Up>& __pu)
  356. {
  357. return __t < _VSTD_LFTS_V2::get_underlying(__pu);
  358. }
  359. template <class _Tp, class _Up>
  360. _LIBCPP_INLINE_VISIBILITY
  361. _LIBCPP_CONSTEXPR bool operator>(const _Tp& __t, const propagate_const<_Up>& __pu)
  362. {
  363. return __t > _VSTD_LFTS_V2::get_underlying(__pu);
  364. }
  365. template <class _Tp, class _Up>
  366. _LIBCPP_INLINE_VISIBILITY
  367. _LIBCPP_CONSTEXPR bool operator<=(const _Tp& __t, const propagate_const<_Up>& __pu)
  368. {
  369. return __t <= _VSTD_LFTS_V2::get_underlying(__pu);
  370. }
  371. template <class _Tp, class _Up>
  372. _LIBCPP_INLINE_VISIBILITY
  373. _LIBCPP_CONSTEXPR bool operator>=(const _Tp& __t, const propagate_const<_Up>& __pu)
  374. {
  375. return __t >= _VSTD_LFTS_V2::get_underlying(__pu);
  376. }
  377. template <class _Tp>
  378. _LIBCPP_INLINE_VISIBILITY
  379. _LIBCPP_CONSTEXPR void swap(propagate_const<_Tp>& __pc1, propagate_const<_Tp>& __pc2) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
  380. {
  381. __pc1.swap(__pc2);
  382. }
  383. template <class _Tp>
  384. _LIBCPP_CONSTEXPR const _Tp& get_underlying(const propagate_const<_Tp>& __pt) _NOEXCEPT
  385. {
  386. return __pt.__t_;
  387. }
  388. template <class _Tp>
  389. _LIBCPP_CONSTEXPR _Tp& get_underlying(propagate_const<_Tp>& __pt) _NOEXCEPT
  390. {
  391. return __pt.__t_;
  392. }
  393. _LIBCPP_END_NAMESPACE_LFTS_V2
  394. _LIBCPP_BEGIN_NAMESPACE_STD
  395. template <class _Tp>
  396. struct hash<experimental::fundamentals_v2::propagate_const<_Tp>>
  397. {
  398. typedef size_t result_type;
  399. typedef experimental::fundamentals_v2::propagate_const<_Tp> argument_type;
  400. size_t operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1) const
  401. {
  402. return std::hash<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1));
  403. }
  404. };
  405. template <class _Tp>
  406. struct equal_to<experimental::fundamentals_v2::propagate_const<_Tp>>
  407. {
  408. typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type;
  409. typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type;
  410. bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1,
  411. const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const
  412. {
  413. return std::equal_to<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2));
  414. }
  415. };
  416. template <class _Tp>
  417. struct not_equal_to<experimental::fundamentals_v2::propagate_const<_Tp>>
  418. {
  419. typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type;
  420. typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type;
  421. bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1,
  422. const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const
  423. {
  424. return std::not_equal_to<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2));
  425. }
  426. };
  427. template <class _Tp>
  428. struct less<experimental::fundamentals_v2::propagate_const<_Tp>>
  429. {
  430. typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type;
  431. typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type;
  432. bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1,
  433. const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const
  434. {
  435. return std::less<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2));
  436. }
  437. };
  438. template <class _Tp>
  439. struct greater<experimental::fundamentals_v2::propagate_const<_Tp>>
  440. {
  441. typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type;
  442. typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type;
  443. bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1,
  444. const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const
  445. {
  446. return std::greater<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2));
  447. }
  448. };
  449. template <class _Tp>
  450. struct less_equal<experimental::fundamentals_v2::propagate_const<_Tp>>
  451. {
  452. typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type;
  453. typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type;
  454. bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1,
  455. const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const
  456. {
  457. return std::less_equal<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2));
  458. }
  459. };
  460. template <class _Tp>
  461. struct greater_equal<experimental::fundamentals_v2::propagate_const<_Tp>>
  462. {
  463. typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type;
  464. typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type;
  465. bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1,
  466. const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const
  467. {
  468. return std::greater_equal<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2));
  469. }
  470. };
  471. _LIBCPP_END_NAMESPACE_STD
  472. #endif // _LIBCPP_STD_VER > 11
  473. #endif // _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST