propagate_const 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. // -*- C++ -*-
  2. //===------------------------ propagate_const -----------------------------===//
  3. //
  4. // The LLVM Compiler Infrastructure
  5. //
  6. // This file is dual licensed under the MIT and the University of Illinois Open
  7. // Source Licenses. See LICENSE.TXT for details.
  8. //
  9. //===----------------------------------------------------------------------===//
  10. #ifndef _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST
  11. #define _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST
  12. /*
  13. propagate_const synopsis
  14. namespace std { namespace experimental { inline namespace fundamentals_v2 {
  15. // [propagate_const]
  16. template <class T> class propagate_const;
  17. // [propagate_const.underlying], underlying pointer access
  18. constexpr const _Tp& _VSTD_LFTS_V2::get_underlying(const propagate_const<T>& pt) noexcept;
  19. constexpr T& _VSTD_LFTS_V2::get_underlying(propagate_const<T>& pt) noexcept;
  20. // [propagate_const.relational], relational operators
  21. template <class T> constexpr bool operator==(const propagate_const<T>& pt, nullptr_t);
  22. template <class T> constexpr bool operator==(nullptr_t, const propagate_const<T>& pu);
  23. template <class T> constexpr bool operator!=(const propagate_const<T>& pt, nullptr_t);
  24. template <class T> constexpr bool operator!=(nullptr_t, const propagate_const<T>& 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 propagate_const<_Up>& pu);
  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 propagate_const<T>& pt, const _Up& u);
  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. template <class T, class U> constexpr bool operator>=(const _Tp& t, const propagate_const<_Up>& pu);
  43. // [propagate_const.algorithms], specialized algorithms
  44. template <class T> constexpr void swap(propagate_const<T>& pt, propagate_const<T>& pu) noexcept(see below);
  45. template <class T>
  46. class propagate_const
  47. {
  48. public:
  49. typedef remove_reference_t<decltype(*declval<T&>())> element_type;
  50. // [propagate_const.ctor], constructors
  51. constexpr propagate_const() = default;
  52. propagate_const(const propagate_const& p) = delete;
  53. constexpr propagate_const(propagate_const&& p) = default;
  54. template <class U> EXPLICIT constexpr propagate_const(propagate_const<_Up>&& pu); // see below
  55. template <class U> EXPLICIT constexpr propagate_const(U&& u); // see below
  56. // [propagate_const.assignment], assignment
  57. propagate_const& operator=(const propagate_const& p) = delete;
  58. constexpr propagate_const& operator=(propagate_const&& p) = default;
  59. template <class U> constexpr propagate_const& operator=(propagate_const<_Up>&& pu);
  60. template <class U> constexpr propagate_const& operator=(U&& u); // see below
  61. // [propagate_const.const_observers], const observers
  62. explicit constexpr operator bool() const;
  63. constexpr const element_type* operator->() const;
  64. constexpr operator const element_type*() const; // Not always defined
  65. constexpr const element_type& operator*() const;
  66. constexpr const element_type* get() const;
  67. // [propagate_const.non_const_observers], non-const observers
  68. constexpr element_type* operator->();
  69. constexpr operator element_type*(); // Not always defined
  70. constexpr element_type& operator*();
  71. constexpr element_type* get();
  72. // [propagate_const.modifiers], modifiers
  73. constexpr void swap(propagate_const& pt) noexcept(see below)
  74. private:
  75. T t_; // exposition only
  76. };
  77. } // namespace fundamentals_v2
  78. } // namespace experimental
  79. // [propagate_const.hash], hash support
  80. template <class T> struct hash<experimental::fundamentals_v2::propagate_const<T>>;
  81. // [propagate_const.comparison_function_objects], comparison function objects
  82. template <class T> struct equal_to<experimental::fundamentals_v2::propagate_const<T>>;
  83. template <class T> struct not_equal_to<experimental::fundamentals_v2::propagate_const<T>>;
  84. template <class T> struct less<experimental::fundamentals_v2::propagate_const<T>>;
  85. template <class T> struct greater<experimental::fundamentals_v2::propagate_const<T>>;
  86. template <class T> struct less_equal<experimental::fundamentals_v2::propagate_const<T>>;
  87. template <class T> struct greater_equal<experimental::fundamentals_v2::propagate_const<T>>;
  88. } // namespace std
  89. */
  90. #include <experimental/__config>
  91. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  92. #pragma GCC system_header
  93. #endif
  94. #if _LIBCPP_STD_VER > 11
  95. #include <type_traits>
  96. #include <utility>
  97. #include <functional>
  98. _LIBCPP_BEGIN_NAMESPACE_LFTS_V2
  99. template <class _Tp>
  100. class propagate_const;
  101. template <class _Up> _LIBCPP_CONSTEXPR const _Up& get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
  102. template <class _Up> _LIBCPP_CONSTEXPR _Up& get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
  103. template <class _Tp>
  104. class propagate_const
  105. {
  106. public:
  107. typedef remove_reference_t<decltype(*_VSTD::declval<_Tp&>())> element_type;
  108. static_assert(!is_array<_Tp>::value,
  109. "Instantiation of propagate_const with an array type is ill-formed.");
  110. static_assert(!is_reference<_Tp>::value,
  111. "Instantiation of propagate_const with a reference type is ill-formed.");
  112. static_assert(!(is_pointer<_Tp>::value && is_function<typename remove_pointer<_Tp>::type>::value),
  113. "Instantiation of propagate_const with a function-pointer type is ill-formed.");
  114. static_assert(!(is_pointer<_Tp>::value && is_same<typename remove_cv<typename remove_pointer<_Tp>::type>::type, void>::value),
  115. "Instantiation of propagate_const with a pointer to (possibly cv-qualified) void is ill-formed.");
  116. private:
  117. template <class _Up>
  118. static _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up* __u)
  119. {
  120. return __u;
  121. }
  122. template <class _Up>
  123. static _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up& __u)
  124. {
  125. return __get_pointer(__u.get());
  126. }
  127. template <class _Up>
  128. static _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up* __u)
  129. {
  130. return __u;
  131. }
  132. template <class _Up>
  133. static _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up& __u)
  134. {
  135. return __get_pointer(__u.get());
  136. }
  137. template <class _Up>
  138. struct __is_propagate_const : false_type
  139. {
  140. };
  141. template <class _Up>
  142. struct __is_propagate_const<propagate_const<_Up>> : true_type
  143. {
  144. };
  145. _Tp __t_;
  146. public:
  147. template <class _Up> friend _LIBCPP_CONSTEXPR const _Up& ::_VSTD_LFTS_V2::get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
  148. template <class _Up> friend _LIBCPP_CONSTEXPR _Up& ::_VSTD_LFTS_V2::get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
  149. _LIBCPP_CONSTEXPR propagate_const() = default;
  150. propagate_const(const propagate_const&) = delete;
  151. _LIBCPP_CONSTEXPR propagate_const(propagate_const&&) = default;
  152. template <class _Up, enable_if_t<!is_convertible<_Up, _Tp>::value &&
  153. is_constructible<_Tp, _Up&&>::value,bool> = true>
  154. explicit _LIBCPP_CONSTEXPR propagate_const(propagate_const<_Up>&& __pu)
  155. : __t_(std::move(_VSTD_LFTS_V2::get_underlying(__pu)))
  156. {
  157. }
  158. template <class _Up, enable_if_t<is_convertible<_Up&&, _Tp>::value &&
  159. is_constructible<_Tp, _Up&&>::value,bool> = false>
  160. _LIBCPP_CONSTEXPR propagate_const(propagate_const<_Up>&& __pu)
  161. : __t_(std::move(_VSTD_LFTS_V2::get_underlying(__pu)))
  162. {
  163. }
  164. template <class _Up, enable_if_t<!is_convertible<_Up&&, _Tp>::value &&
  165. is_constructible<_Tp, _Up&&>::value &&
  166. !__is_propagate_const<decay_t<_Up>>::value,bool> = true>
  167. explicit _LIBCPP_CONSTEXPR propagate_const(_Up&& __u)
  168. : __t_(std::forward<_Up>(__u))
  169. {
  170. }
  171. template <class _Up, enable_if_t<is_convertible<_Up&&, _Tp>::value &&
  172. is_constructible<_Tp, _Up&&>::value &&
  173. !__is_propagate_const<decay_t<_Up>>::value,bool> = false>
  174. _LIBCPP_CONSTEXPR propagate_const(_Up&& __u)
  175. : __t_(std::forward<_Up>(__u))
  176. {
  177. }
  178. propagate_const& operator=(const propagate_const&) = delete;
  179. _LIBCPP_CONSTEXPR propagate_const& operator=(propagate_const&&) = default;
  180. template <class _Up>
  181. _LIBCPP_CONSTEXPR propagate_const& operator=(propagate_const<_Up>&& __pu)
  182. {
  183. __t_ = std::move(_VSTD_LFTS_V2::get_underlying(__pu));
  184. return *this;
  185. }
  186. template <class _Up, class _Vp = enable_if_t<!__is_propagate_const<decay_t<_Up>>::value>>
  187. _LIBCPP_CONSTEXPR propagate_const& operator=(_Up&& __u)
  188. {
  189. __t_ = std::forward<_Up>(__u);
  190. return *this;
  191. }
  192. _LIBCPP_CONSTEXPR const element_type* get() const
  193. {
  194. return __get_pointer(__t_);
  195. }
  196. _LIBCPP_CONSTEXPR element_type* get()
  197. {
  198. return __get_pointer(__t_);
  199. }
  200. explicit _LIBCPP_CONSTEXPR operator bool() const
  201. {
  202. return get() != nullptr;
  203. }
  204. _LIBCPP_CONSTEXPR const element_type* operator->() const
  205. {
  206. return get();
  207. }
  208. template <class _Tp_ = _Tp, class _Up = enable_if_t<is_convertible<
  209. const _Tp_, const element_type *>::value>>
  210. _LIBCPP_CONSTEXPR operator const element_type *() const {
  211. return get();
  212. }
  213. _LIBCPP_CONSTEXPR const element_type& operator*() const
  214. {
  215. return *get();
  216. }
  217. _LIBCPP_CONSTEXPR element_type* operator->()
  218. {
  219. return get();
  220. }
  221. template <class _Tp_ = _Tp, class _Up = enable_if_t<
  222. is_convertible<_Tp_, element_type *>::value>>
  223. _LIBCPP_CONSTEXPR operator element_type *() {
  224. return get();
  225. }
  226. _LIBCPP_CONSTEXPR element_type& operator*()
  227. {
  228. return *get();
  229. }
  230. _LIBCPP_CONSTEXPR void swap(propagate_const& __pt) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
  231. {
  232. using _VSTD::swap;
  233. swap(__t_, __pt.__t_);
  234. }
  235. };
  236. template <class _Tp>
  237. _LIBCPP_INLINE_VISIBILITY
  238. _LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, nullptr_t)
  239. {
  240. return _VSTD_LFTS_V2::get_underlying(__pt) == nullptr;
  241. }
  242. template <class _Tp>
  243. _LIBCPP_INLINE_VISIBILITY
  244. _LIBCPP_CONSTEXPR bool operator==(nullptr_t, const propagate_const<_Tp>& __pt)
  245. {
  246. return nullptr == _VSTD_LFTS_V2::get_underlying(__pt);
  247. }
  248. template <class _Tp>
  249. _LIBCPP_INLINE_VISIBILITY
  250. _LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, nullptr_t)
  251. {
  252. return _VSTD_LFTS_V2::get_underlying(__pt) != nullptr;
  253. }
  254. template <class _Tp>
  255. _LIBCPP_INLINE_VISIBILITY
  256. _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, const propagate_const<_Tp>& __pt)
  257. {
  258. return nullptr != _VSTD_LFTS_V2::get_underlying(__pt);
  259. }
  260. template <class _Tp, class _Up>
  261. _LIBCPP_INLINE_VISIBILITY
  262. _LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt,
  263. const propagate_const<_Up>& __pu)
  264. {
  265. return _VSTD_LFTS_V2::get_underlying(__pt) == _VSTD_LFTS_V2::get_underlying(__pu);
  266. }
  267. template <class _Tp, class _Up>
  268. _LIBCPP_INLINE_VISIBILITY
  269. _LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt,
  270. const propagate_const<_Up>& __pu)
  271. {
  272. return _VSTD_LFTS_V2::get_underlying(__pt) != _VSTD_LFTS_V2::get_underlying(__pu);
  273. }
  274. template <class _Tp, class _Up>
  275. _LIBCPP_INLINE_VISIBILITY
  276. _LIBCPP_CONSTEXPR bool operator<(const propagate_const<_Tp>& __pt,
  277. const propagate_const<_Up>& __pu)
  278. {
  279. return _VSTD_LFTS_V2::get_underlying(__pt) < _VSTD_LFTS_V2::get_underlying(__pu);
  280. }
  281. template <class _Tp, class _Up>
  282. _LIBCPP_INLINE_VISIBILITY
  283. _LIBCPP_CONSTEXPR bool operator>(const propagate_const<_Tp>& __pt,
  284. const propagate_const<_Up>& __pu)
  285. {
  286. return _VSTD_LFTS_V2::get_underlying(__pt) > _VSTD_LFTS_V2::get_underlying(__pu);
  287. }
  288. template <class _Tp, class _Up>
  289. _LIBCPP_INLINE_VISIBILITY
  290. _LIBCPP_CONSTEXPR bool operator<=(const propagate_const<_Tp>& __pt,
  291. const propagate_const<_Up>& __pu)
  292. {
  293. return _VSTD_LFTS_V2::get_underlying(__pt) <= _VSTD_LFTS_V2::get_underlying(__pu);
  294. }
  295. template <class _Tp, class _Up>
  296. _LIBCPP_INLINE_VISIBILITY
  297. _LIBCPP_CONSTEXPR bool operator>=(const propagate_const<_Tp>& __pt,
  298. const propagate_const<_Up>& __pu)
  299. {
  300. return _VSTD_LFTS_V2::get_underlying(__pt) >= _VSTD_LFTS_V2::get_underlying(__pu);
  301. }
  302. template <class _Tp, class _Up>
  303. _LIBCPP_INLINE_VISIBILITY
  304. _LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, const _Up& __u)
  305. {
  306. return _VSTD_LFTS_V2::get_underlying(__pt) == __u;
  307. }
  308. template <class _Tp, class _Up>
  309. _LIBCPP_INLINE_VISIBILITY
  310. _LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, const _Up& __u)
  311. {
  312. return _VSTD_LFTS_V2::get_underlying(__pt) != __u;
  313. }
  314. template <class _Tp, class _Up>
  315. _LIBCPP_INLINE_VISIBILITY
  316. _LIBCPP_CONSTEXPR bool operator<(const propagate_const<_Tp>& __pt, const _Up& __u)
  317. {
  318. return _VSTD_LFTS_V2::get_underlying(__pt) < __u;
  319. }
  320. template <class _Tp, class _Up>
  321. _LIBCPP_INLINE_VISIBILITY
  322. _LIBCPP_CONSTEXPR bool operator>(const propagate_const<_Tp>& __pt, const _Up& __u)
  323. {
  324. return _VSTD_LFTS_V2::get_underlying(__pt) > __u;
  325. }
  326. template <class _Tp, class _Up>
  327. _LIBCPP_INLINE_VISIBILITY
  328. _LIBCPP_CONSTEXPR bool operator<=(const propagate_const<_Tp>& __pt, const _Up& __u)
  329. {
  330. return _VSTD_LFTS_V2::get_underlying(__pt) <= __u;
  331. }
  332. template <class _Tp, class _Up>
  333. _LIBCPP_INLINE_VISIBILITY
  334. _LIBCPP_CONSTEXPR bool operator>=(const propagate_const<_Tp>& __pt, const _Up& __u)
  335. {
  336. return _VSTD_LFTS_V2::get_underlying(__pt) >= __u;
  337. }
  338. template <class _Tp, class _Up>
  339. _LIBCPP_INLINE_VISIBILITY
  340. _LIBCPP_CONSTEXPR bool operator==(const _Tp& __t, const propagate_const<_Up>& __pu)
  341. {
  342. return __t == _VSTD_LFTS_V2::get_underlying(__pu);
  343. }
  344. template <class _Tp, class _Up>
  345. _LIBCPP_INLINE_VISIBILITY
  346. _LIBCPP_CONSTEXPR bool operator!=(const _Tp& __t, const propagate_const<_Up>& __pu)
  347. {
  348. return __t != _VSTD_LFTS_V2::get_underlying(__pu);
  349. }
  350. template <class _Tp, class _Up>
  351. _LIBCPP_INLINE_VISIBILITY
  352. _LIBCPP_CONSTEXPR bool operator<(const _Tp& __t, const propagate_const<_Up>& __pu)
  353. {
  354. return __t < _VSTD_LFTS_V2::get_underlying(__pu);
  355. }
  356. template <class _Tp, class _Up>
  357. _LIBCPP_INLINE_VISIBILITY
  358. _LIBCPP_CONSTEXPR bool operator>(const _Tp& __t, const propagate_const<_Up>& __pu)
  359. {
  360. return __t > _VSTD_LFTS_V2::get_underlying(__pu);
  361. }
  362. template <class _Tp, class _Up>
  363. _LIBCPP_INLINE_VISIBILITY
  364. _LIBCPP_CONSTEXPR bool operator<=(const _Tp& __t, const propagate_const<_Up>& __pu)
  365. {
  366. return __t <= _VSTD_LFTS_V2::get_underlying(__pu);
  367. }
  368. template <class _Tp, class _Up>
  369. _LIBCPP_INLINE_VISIBILITY
  370. _LIBCPP_CONSTEXPR bool operator>=(const _Tp& __t, const propagate_const<_Up>& __pu)
  371. {
  372. return __t >= _VSTD_LFTS_V2::get_underlying(__pu);
  373. }
  374. template <class _Tp>
  375. _LIBCPP_INLINE_VISIBILITY
  376. _LIBCPP_CONSTEXPR void swap(propagate_const<_Tp>& __pc1, propagate_const<_Tp>& __pc2) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
  377. {
  378. using _VSTD::swap;
  379. swap(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2));
  380. }
  381. template <class _Tp>
  382. _LIBCPP_INLINE_VISIBILITY
  383. _LIBCPP_CONSTEXPR const _Tp& get_underlying(const propagate_const<_Tp>& __pt) _NOEXCEPT
  384. {
  385. return __pt.__t_;
  386. }
  387. template <class _Tp>
  388. _LIBCPP_INLINE_VISIBILITY
  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