Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/c++/v1/utility is written in an unsupported language. File is not indexed.

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP_UTILITY
0011 #define _LIBCPP_UTILITY
0012 
0013 /*
0014     utility synopsis
0015 
0016 #include <initializer_list>
0017 
0018 namespace std
0019 {
0020 
0021 template <class T>
0022     void
0023     swap(T& a, T& b);
0024 
0025 namespace rel_ops
0026 {
0027     template<class T> bool operator!=(const T&, const T&);
0028     template<class T> bool operator> (const T&, const T&);
0029     template<class T> bool operator<=(const T&, const T&);
0030     template<class T> bool operator>=(const T&, const T&);
0031 }
0032 
0033 template<class T>
0034 void
0035 swap(T& a, T& b) noexcept(is_nothrow_move_constructible<T>::value &&
0036                           is_nothrow_move_assignable<T>::value);
0037 
0038 template <class T, size_t N>
0039 void
0040 swap(T (&a)[N], T (&b)[N]) noexcept(noexcept(swap(*a, *b)));
0041 
0042 template <class T> T&& forward(typename remove_reference<T>::type& t) noexcept;  // constexpr in C++14
0043 template <class T> T&& forward(typename remove_reference<T>::type&& t) noexcept; // constexpr in C++14
0044 
0045 template <typename T>
0046 [[nodiscard]] constexpr
0047 auto forward_like(auto&& x) noexcept -> see below;                               // since C++23
0048 
0049 template <class T> typename remove_reference<T>::type&& move(T&&) noexcept;      // constexpr in C++14
0050 
0051 template <class T>
0052     typename conditional
0053     <
0054         !is_nothrow_move_constructible<T>::value && is_copy_constructible<T>::value,
0055         const T&,
0056         T&&
0057     >::type
0058     move_if_noexcept(T& x) noexcept; // constexpr in C++14
0059 
0060 template <class T> constexpr add_const_t<T>& as_const(T& t) noexcept;      // C++17
0061 template <class T>                      void as_const(const T&&) = delete; // C++17
0062 
0063 template <class T> typename add_rvalue_reference<T>::type declval() noexcept;
0064 
0065 template<class T, class U> constexpr bool cmp_equal(T t, U u) noexcept;         // C++20
0066 template<class T, class U> constexpr bool cmp_not_equal(T t, U u) noexcept;     // C++20
0067 template<class T, class U> constexpr bool cmp_less(T t, U u) noexcept;          // C++20
0068 template<class T, class U> constexpr bool cmp_greater(T t, U u) noexcept;       // C++20
0069 template<class T, class U> constexpr bool cmp_less_equal(T t, U u) noexcept;    // C++20
0070 template<class T, class U> constexpr bool cmp_greater_equal(T t, U u) noexcept; // C++20
0071 template<class R, class T> constexpr bool in_range(T t) noexcept;               // C++20
0072 
0073 template <class T1, class T2>
0074 struct pair
0075 {
0076     typedef T1 first_type;
0077     typedef T2 second_type;
0078 
0079     T1 first;
0080     T2 second;
0081 
0082     pair(const pair&) = default;
0083     pair(pair&&) = default;
0084     explicit(see-below) constexpr pair();
0085     explicit(see-below) pair(const T1& x, const T2& y);                          // constexpr in C++14
0086     template <class U = T1, class V = T2> explicit(see-below) pair(U&&, V&&);    // constexpr in C++14
0087     template <class U, class V> constexpr explicit(see-below) pair(pair<U, V>&); // since C++23
0088     template <class U, class V> explicit(see-below) pair(const pair<U, V>& p);   // constexpr in C++14
0089     template <class U, class V> explicit(see-below) pair(pair<U, V>&& p);        // constexpr in C++14
0090     template <class U, class V>
0091     constexpr explicit(see-below) pair(const pair<U, V>&&);                      // since C++23
0092     template <pair-like P> constexpr explicit(see-below) pair(P&&);              // since C++23
0093     template <class... Args1, class... Args2>
0094         pair(piecewise_construct_t, tuple<Args1...> first_args,                  // constexpr in C++20
0095                                     tuple<Args2...> second_args);
0096 
0097     constexpr const pair& operator=(const pair& p) const;                        // since C++23
0098     template <class U, class V> pair& operator=(const pair<U, V>& p);            // constexpr in C++20
0099     template <class U, class V>
0100     constexpr const pair& operator=(const pair<U, V>& p) const;                  // since C++23
0101     pair& operator=(pair&& p) noexcept(is_nothrow_move_assignable<T1>::value &&
0102                                        is_nothrow_move_assignable<T2>::value);   // constexpr in C++20
0103     constexpr const pair& operator=(pair&& p) const;                             // since C++23
0104     template <class U, class V> pair& operator=(pair<U, V>&& p);                 // constexpr in C++20
0105     template <class U, class V>
0106     constexpr const pair& operator=(pair<U, V>&& p) const;                       // since C++23
0107     template <pair-like P> constexpr pair& operator=(P&&);                       // since C++23
0108     template <pair-like P> constexpr const pair& operator=(P&&) const;           // since C++23
0109 
0110     void swap(pair& p) noexcept(is_nothrow_swappable_v<T1> &&
0111                                 is_nothrow_swappable_v<T2>);                     // constexpr in C++20
0112     constexpr void swap(const pair& p) const noexcept(see below);                // since C++23
0113 };
0114 
0115 template<class T1, class T2, class U1, class U2, template<class> class TQual, template<class> class UQual>
0116 struct basic_common_reference<pair<T1, T2>, pair<U1, U2>, TQual, UQual>;         // since C++23
0117 
0118 template<class T1, class T2, class U1, class U2>
0119 struct common_type<pair<T1, T2>, pair<U1, U2>>;                                  // since C++23
0120 
0121 template<class T1, class T2> pair(T1, T2) -> pair<T1, T2>;
0122 
0123 template <class T1, class T2, class U1, class U2>
0124 bool operator==(const pair<T1,T2>&, const pair<U1,U2>&);                         // constexpr in C++14
0125 template <class T1, class T2, class U1, class U2>
0126 bool operator!=(const pair<T1,T2>&, const pair<U1,U2>&);                         // constexpr in C++14, removed in C++20
0127 template <class T1, class T2, class U1, class U2>
0128 bool operator< (const pair<T1,T2>&, const pair<U1,U2>&);                         // constexpr in C++14, removed in C++20
0129 template <class T1, class T2, class U1, class U2>
0130 bool operator> (const pair<T1,T2>&, const pair<U1,U2>&);                         // constexpr in C++14, removed in C++20
0131 template <class T1, class T2, class U1, class U2>
0132 bool operator>=(const pair<T1,T2>&, const pair<U1,U2>&);                         // constexpr in C++14, removed in C++20
0133 template <class T1, class T2, class U1, class U2>
0134 bool operator<=(const pair<T1,T2>&, const pair<U1,U2>&);                         // constexpr in C++14, removed in C++20
0135 template <class T1, class T2, class U1, class U2>
0136   constexpr common_comparison_type_t<synth-three-way-result<T1,U1>,
0137                                      synth-three-way-result<T2,U2>>
0138     operator<=>(const pair<T1,T2>&, const pair<U1,U2>&);                         // C++20
0139 
0140 template <class T1, class T2> pair<V1, V2> make_pair(T1&&, T2&&);                // constexpr in C++14
0141 template <class T1, class T2>
0142 void
0143 swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));            // constexpr in C++20
0144 
0145 template<class T1, class T2>                                                     // since C++23
0146 constexpr void swap(const pair<T1, T2>& x, const pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
0147 
0148 struct piecewise_construct_t { explicit piecewise_construct_t() = default; };
0149 inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
0150 
0151 template <class T> struct tuple_size;
0152 template <size_t I, class T> struct tuple_element;
0153 
0154 template <class T1, class T2> struct tuple_size<pair<T1, T2> >;
0155 template <class T1, class T2> struct tuple_element<0, pair<T1, T2> >;
0156 template <class T1, class T2> struct tuple_element<1, pair<T1, T2> >;
0157 
0158 template<size_t I, class T1, class T2>
0159     typename tuple_element<I, pair<T1, T2> >::type&
0160     get(pair<T1, T2>&) noexcept; // constexpr in C++14
0161 
0162 template<size_t I, class T1, class T2>
0163     const typename tuple_element<I, pair<T1, T2> >::type&
0164     get(const pair<T1, T2>&) noexcept; // constexpr in C++14
0165 
0166 template<size_t I, class T1, class T2>
0167     typename tuple_element<I, pair<T1, T2> >::type&&
0168     get(pair<T1, T2>&&) noexcept; // constexpr in C++14
0169 
0170 template<size_t I, class T1, class T2>
0171     const typename tuple_element<I, pair<T1, T2> >::type&&
0172     get(const pair<T1, T2>&&) noexcept; // constexpr in C++14
0173 
0174 template<class T1, class T2>
0175     constexpr T1& get(pair<T1, T2>&) noexcept; // C++14
0176 
0177 template<class T1, class T2>
0178     constexpr const T1& get(const pair<T1, T2>&) noexcept; // C++14
0179 
0180 template<class T1, class T2>
0181     constexpr T1&& get(pair<T1, T2>&&) noexcept; // C++14
0182 
0183 template<class T1, class T2>
0184     constexpr const T1&& get(const pair<T1, T2>&&) noexcept; // C++14
0185 
0186 template<class T1, class T2>
0187     constexpr T1& get(pair<T2, T1>&) noexcept; // C++14
0188 
0189 template<class T1, class T2>
0190     constexpr const T1& get(const pair<T2, T1>&) noexcept; // C++14
0191 
0192 template<class T1, class T2>
0193     constexpr T1&& get(pair<T2, T1>&&) noexcept; // C++14
0194 
0195 template<class T1, class T2>
0196     constexpr const T1&& get(const pair<T2, T1>&&) noexcept; // C++14
0197 
0198 // C++14
0199 
0200 template<class T, T... I>
0201 struct integer_sequence
0202 {
0203     typedef T value_type;
0204 
0205     static constexpr size_t size() noexcept;
0206 };
0207 
0208 template<size_t... I>
0209   using index_sequence = integer_sequence<size_t, I...>;
0210 
0211 template<class T, T N>
0212   using make_integer_sequence = integer_sequence<T, 0, 1, ..., N-1>;
0213 template<size_t N>
0214   using make_index_sequence = make_integer_sequence<size_t, N>;
0215 
0216 template<class... T>
0217   using index_sequence_for = make_index_sequence<sizeof...(T)>;
0218 
0219 template<class T, class U=T>
0220     constexpr T exchange(T& obj, U&& new_value)                                 // constexpr in C++17, noexcept in C++23
0221       noexcept(is_nothrow_move_constructible<T>::value && is_nothrow_assignable<T&, U>::value);
0222 
0223 // 20.2.7, in-place construction // C++17
0224 struct in_place_t {
0225   explicit in_place_t() = default;
0226 };
0227 inline constexpr in_place_t in_place{};
0228 template <class T>
0229   struct in_place_type_t {
0230     explicit in_place_type_t() = default;
0231   };
0232 template <class T>
0233   inline constexpr in_place_type_t<T> in_place_type{};
0234 template <size_t I>
0235   struct in_place_index_t {
0236     explicit in_place_index_t() = default;
0237   };
0238 template <size_t I>
0239   inline constexpr in_place_index_t<I> in_place_index{};
0240 
0241 // [utility.underlying], to_underlying
0242 template <class T>
0243     constexpr underlying_type_t<T> to_underlying( T value ) noexcept; // C++23
0244 
0245 }  // std
0246 
0247 */
0248 
0249 #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0250 #  include <__cxx03/utility>
0251 #else
0252 #  include <__config>
0253 
0254 #  include <__utility/declval.h>
0255 #  include <__utility/forward.h>
0256 #  include <__utility/move.h>
0257 #  include <__utility/pair.h>
0258 #  include <__utility/piecewise_construct.h>
0259 #  include <__utility/rel_ops.h>
0260 #  include <__utility/swap.h>
0261 
0262 #  if _LIBCPP_STD_VER >= 14
0263 #    include <__utility/exchange.h>
0264 #    include <__utility/integer_sequence.h>
0265 #  endif
0266 
0267 #  if _LIBCPP_STD_VER >= 17
0268 #    include <__utility/as_const.h>
0269 #    include <__utility/in_place.h>
0270 #  endif
0271 
0272 #  if _LIBCPP_STD_VER >= 20
0273 #    include <__utility/cmp.h>
0274 #  endif
0275 
0276 #  if _LIBCPP_STD_VER >= 23
0277 #    include <__utility/forward_like.h>
0278 #    include <__utility/to_underlying.h>
0279 #    include <__utility/unreachable.h>
0280 #  endif
0281 
0282 #  include <version>
0283 
0284 // standard-mandated includes
0285 
0286 // [utility.syn]
0287 #  include <compare>
0288 #  include <initializer_list>
0289 
0290 // [tuple.creation]
0291 
0292 #  include <__tuple/ignore.h>
0293 
0294 // [tuple.helper]
0295 #  include <__tuple/tuple_element.h>
0296 #  include <__tuple/tuple_size.h>
0297 
0298 #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0299 #    pragma GCC system_header
0300 #  endif
0301 
0302 #  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
0303 #    include <limits>
0304 #  endif
0305 
0306 #  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
0307 #    include <cstddef>
0308 #    include <cstdlib>
0309 #    include <iosfwd>
0310 #    include <type_traits>
0311 #  endif
0312 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0313 
0314 #endif // _LIBCPP_UTILITY