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