| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- | 
 | 2 | //===-------------------------- utility -----------------------------------===// | 
 | 3 | // | 
| Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 4 | //                     The LLVM Compiler Infrastructure | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 5 | // | 
 | 6 | // This file is distributed under the University of Illinois Open Source | 
 | 7 | // License. See LICENSE.TXT for details. | 
 | 8 | // | 
 | 9 | //===----------------------------------------------------------------------===// | 
 | 10 |  | 
 | 11 | #ifndef _LIBCPP_UTILITY | 
 | 12 | #define _LIBCPP_UTILITY | 
 | 13 |  | 
 | 14 | /* | 
 | 15 |     utility synopsis | 
 | 16 |  | 
 | 17 | namespace std | 
 | 18 | { | 
 | 19 |  | 
 | 20 | template <class T> | 
 | 21 |     void | 
 | 22 |     swap(T& a, T& b); | 
 | 23 |  | 
 | 24 | namespace rel_ops | 
 | 25 | { | 
 | 26 |     template<class T> bool operator!=(const T&, const T&); | 
 | 27 |     template<class T> bool operator> (const T&, const T&); | 
 | 28 |     template<class T> bool operator<=(const T&, const T&); | 
 | 29 |     template<class T> bool operator>=(const T&, const T&); | 
 | 30 | } | 
 | 31 |  | 
 | 32 | template<class T> void swap(T& a, T& b); | 
 | 33 | template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]); | 
 | 34 |  | 
 | 35 | template <class T, class U> T&& forward(U&&); | 
 | 36 | template <class T> typename remove_reference<T>::type&& move(T&&); | 
 | 37 |  | 
 | 38 | template <class T> | 
 | 39 |     typename conditional | 
 | 40 |     < | 
 | 41 |         !has_nothrow_move_constructor<T>::value && has_copy_constructor<T>::value, | 
 | 42 |         const T&, | 
 | 43 |         T&& | 
 | 44 |     >::type | 
 | 45 |     move_if_noexcept(T& x); | 
 | 46 |  | 
 | 47 | template <class T> typename add_rvalue_reference<T>::type declval() noexcept; | 
 | 48 |  | 
 | 49 | template <class T1, class T2> | 
 | 50 | struct pair | 
 | 51 | { | 
 | 52 |     typedef T1 first_type; | 
 | 53 |     typedef T2 second_type; | 
 | 54 |  | 
 | 55 |     T1 first; | 
 | 56 |     T2 second; | 
 | 57 |  | 
 | 58 |     pair(const pair&) = default; | 
 | 59 |     constexpr pair(); | 
 | 60 |     pair(const T1& x, const T2& y); | 
 | 61 |     template <class U, class V> pair(U&& x, V&& y); | 
 | 62 |     template <class U, class V> pair(const pair<U, V>& p); | 
 | 63 |     template <class U, class V> pair(pair<U, V>&& p); | 
 | 64 |     template <class... Args1, class... Args2> | 
 | 65 |         pair(piecewise_construct_t, tuple<Args1...> first_args, | 
 | 66 |              tuple<Args2...> second_args); | 
 | 67 |  | 
 | 68 |     template <class U, class V> pair& operator=(const pair<U, V>& p); | 
 | 69 |     pair& operator=(pair&& p); | 
 | 70 |     template <class U, class V> pair& operator=(pair<U, V>&& p); | 
 | 71 |  | 
 | 72 |     void swap(pair& p); | 
 | 73 | }; | 
 | 74 |  | 
 | 75 | template <class T1, class T2> bool operator==(const pair<T1,T2>&, const pair<T1,T2>&); | 
 | 76 | template <class T1, class T2> bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&); | 
 | 77 | template <class T1, class T2> bool operator< (const pair<T1,T2>&, const pair<T1,T2>&); | 
 | 78 | template <class T1, class T2> bool operator> (const pair<T1,T2>&, const pair<T1,T2>&); | 
 | 79 | template <class T1, class T2> bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&); | 
 | 80 | template <class T1, class T2> bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&); | 
 | 81 |  | 
 | 82 | template <class T1, class T2> pair<V1, V2> make_pair(T1&&, T2&&); | 
 | 83 | template <class T1, class T2> void swap(pair<T1, T2>& x, pair<T1, T2>& y); | 
 | 84 |  | 
 | 85 | struct piecewise_construct_t { }; | 
 | 86 | constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); | 
 | 87 |  | 
 | 88 | template <class T> class tuple_size; | 
 | 89 | template <size_t I, class T> class tuple_element; | 
 | 90 |  | 
 | 91 | template <class T1, class T2> struct tuple_size<std::pair<T1, T2> >; | 
 | 92 | template <class T1, class T2> struct tuple_element<0, std::pair<T1, T2> >; | 
 | 93 | template <class T1, class T2> struct tuple_element<1, std::pair<T1, T2> >; | 
 | 94 |  | 
 | 95 | template<size_t I, class T1, class T2> | 
 | 96 |     typename tuple_element<I, std::pair<T1, T2> >::type& | 
 | 97 |     get(std::pair<T1, T2>&); | 
 | 98 |  | 
 | 99 | template<size_t I, class T1, class T2> | 
 | 100 |     const typename const tuple_element<I, std::pair<T1, T2> >::type& | 
 | 101 |     get(const std::pair<T1, T2>&); | 
 | 102 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 103 | }  // std | 
 | 104 |  | 
 | 105 | */ | 
 | 106 |  | 
 | 107 | #include <__config> | 
 | 108 | #include <__tuple> | 
 | 109 | #include <type_traits> | 
 | 110 |  | 
 | 111 | #pragma GCC system_header | 
 | 112 |  | 
 | 113 | _LIBCPP_BEGIN_NAMESPACE_STD | 
 | 114 |  | 
 | 115 | namespace rel_ops | 
 | 116 | { | 
 | 117 |  | 
 | 118 | template<class _Tp> | 
 | 119 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 120 | bool | 
 | 121 | operator!=(const _Tp& __x, const _Tp& __y) | 
 | 122 | { | 
 | 123 |     return !(__x == __y); | 
 | 124 | } | 
 | 125 |  | 
 | 126 | template<class _Tp> | 
 | 127 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 128 | bool | 
 | 129 | operator> (const _Tp& __x, const _Tp& __y) | 
 | 130 | { | 
 | 131 |     return __y < __x; | 
 | 132 | } | 
 | 133 |  | 
 | 134 | template<class _Tp> | 
 | 135 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 136 | bool | 
 | 137 | operator<=(const _Tp& __x, const _Tp& __y) | 
 | 138 | { | 
 | 139 |     return !(__y < __x); | 
 | 140 | } | 
 | 141 |  | 
 | 142 | template<class _Tp> | 
 | 143 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 144 | bool | 
 | 145 | operator>=(const _Tp& __x, const _Tp& __y) | 
 | 146 | { | 
 | 147 |     return !(__x < __y); | 
 | 148 | } | 
 | 149 |  | 
 | 150 | }  // rel_ops | 
 | 151 |  | 
 | 152 | // swap_ranges | 
 | 153 |  | 
 | 154 | template <class _ForwardIterator1, class _ForwardIterator2> | 
 | 155 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 156 | _ForwardIterator2 | 
 | 157 | swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) | 
 | 158 | { | 
 | 159 |     for(; __first1 != __last1; ++__first1, ++__first2) | 
 | 160 |         swap(*__first1, *__first2); | 
 | 161 |     return __first2; | 
 | 162 | } | 
 | 163 |  | 
 | 164 | template<class _Tp, size_t _N> | 
 | 165 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 166 | void | 
 | 167 | swap(_Tp (&__a)[_N], _Tp (&__b)[_N]) | 
 | 168 | { | 
 | 169 |     _STD::swap_ranges(__a, __a + _N, __b); | 
 | 170 | } | 
 | 171 |  | 
 | 172 | template <class _Tp> | 
 | 173 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 174 | #ifdef _LIBCPP_MOVE | 
 | 175 | typename conditional | 
 | 176 | < | 
 | 177 |     !has_nothrow_move_constructor<_Tp>::value && has_copy_constructor<_Tp>::value, | 
 | 178 |     const _Tp&, | 
 | 179 |     _Tp&& | 
 | 180 | >::type | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame^] | 181 | #else  // _LIBCPP_MOVE | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 182 | const _Tp& | 
 | 183 | #endif | 
 | 184 | move_if_noexcept(_Tp& __x) | 
 | 185 | { | 
 | 186 |     return _STD::move(__x); | 
 | 187 | } | 
 | 188 |  | 
 | 189 | struct piecewise_construct_t { }; | 
 | 190 | //constexpr | 
 | 191 | extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t(); | 
 | 192 |  | 
 | 193 | template <class _T1, class _T2> struct pair; | 
 | 194 | template <class _T1, class _T2> void swap(pair<_T1, _T2>&, pair<_T1, _T2>&); | 
 | 195 |  | 
 | 196 | template <class _T1, class _T2> | 
 | 197 | struct pair | 
 | 198 | { | 
 | 199 |     typedef _T1 first_type; | 
 | 200 |     typedef _T2 second_type; | 
 | 201 |  | 
 | 202 |     _T1 first; | 
 | 203 |     _T2 second; | 
 | 204 |  | 
 | 205 |     _LIBCPP_INLINE_VISIBILITY pair() : first(), second() {} | 
 | 206 |  | 
 | 207 |     _LIBCPP_INLINE_VISIBILITY pair(const _T1& __x, const _T2& __y) | 
 | 208 |         : first(__x), second(__y) {} | 
 | 209 |  | 
 | 210 | #ifdef _LIBCPP_MOVE | 
 | 211 |  | 
 | 212 |     template <class _U1, class _U2, | 
 | 213 |               class = typename enable_if<is_convertible<_U1, first_type >::value && | 
 | 214 |                                          is_convertible<_U2, second_type>::value>::type> | 
 | 215 |         _LIBCPP_INLINE_VISIBILITY | 
 | 216 |         pair(_U1&& __u1, _U2&& __u2) | 
 | 217 |             : first(_STD::forward<_U1>(__u1)), | 
 | 218 |               second(_STD::forward<_U2>(__u2)) | 
 | 219 |             {} | 
 | 220 |  | 
| Howard Hinnant | 60a0a8e | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 221 | #ifndef _LIBCPP_HAS_NO_VARIADICS | 
 | 222 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 223 |     template<class _Tuple, | 
 | 224 |              class = typename enable_if<__tuple_convertible<_Tuple, pair>::value>::type> | 
 | 225 |         _LIBCPP_INLINE_VISIBILITY | 
 | 226 |         pair(_Tuple&& __p) | 
 | 227 |             : first(_STD::forward<typename tuple_element<0, | 
 | 228 |                                   typename __make_tuple_types<_Tuple>::type>::type>(get<0>(__p))), | 
 | 229 |               second(_STD::forward<typename tuple_element<1, | 
 | 230 |                                    typename __make_tuple_types<_Tuple>::type>::type>(get<1>(__p))) | 
 | 231 |             {} | 
 | 232 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 233 |     template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2> | 
 | 234 |         pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, | 
 | 235 |                                     tuple<_Args2...> __second_args) | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame^] | 236 |             : pair(__pc, __first_args, __second_args, | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 237 |                    typename __make_tuple_indices<sizeof...(_Args1)>::type(), | 
 | 238 |                    typename __make_tuple_indices<sizeof...(_Args2) >::type()) | 
 | 239 |             {} | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 240 |  | 
 | 241 |     template <class _Tuple, | 
 | 242 |               class = typename enable_if<__tuple_assignable<_Tuple, pair>::value>::type> | 
 | 243 |         pair& | 
 | 244 |         operator=(_Tuple&& __p) | 
 | 245 |         { | 
 | 246 |             typedef typename __make_tuple_types<_Tuple>::type _TupleRef; | 
 | 247 |             typedef typename tuple_element<0, _TupleRef>::type _U0; | 
 | 248 |             typedef typename tuple_element<1, _TupleRef>::type _U1; | 
 | 249 |             first  = _STD::forward<_U0>(_STD::get<0>(__p)); | 
 | 250 |             second = _STD::forward<_U1>(_STD::get<1>(__p)); | 
 | 251 |             return *this; | 
 | 252 |         } | 
 | 253 |  | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame^] | 254 | #endif  // _LIBCPP_HAS_NO_VARIADICS | 
| Howard Hinnant | 60a0a8e | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 255 |  | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame^] | 256 | #else  // _LIBCPP_MOVE | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 257 |     template<class _U1, class _U2> | 
 | 258 |         _LIBCPP_INLINE_VISIBILITY pair(const pair<_U1, _U2>& __p) | 
 | 259 |             : first(__p.first), second(__p.second) {} | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame^] | 260 | #endif  // _LIBCPP_MOVE | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 261 |     void _LIBCPP_INLINE_VISIBILITY swap(pair& __p) {_STD::swap(*this, __p);} | 
 | 262 | private: | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame^] | 263 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 264 | #ifndef _LIBCPP_HAS_NO_VARIADICS | 
 | 265 |     template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2> | 
 | 266 |         pair(piecewise_construct_t, | 
 | 267 |              tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, | 
 | 268 |              __tuple_indices<_I1...>, __tuple_indices<_I2...>); | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame^] | 269 | #endif  // _LIBCPP_HAS_NO_VARIADICS | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 270 | }; | 
 | 271 |  | 
 | 272 | template <class _T1, class _T2> | 
 | 273 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 274 | bool | 
 | 275 | operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) | 
 | 276 | { | 
 | 277 |     return __x.first == __y.first && __x.second == __y.second; | 
 | 278 | } | 
 | 279 |  | 
 | 280 | template <class _T1, class _T2> | 
 | 281 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 282 | bool | 
 | 283 | operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) | 
 | 284 | { | 
 | 285 |     return !(__x == __y); | 
 | 286 | } | 
 | 287 |  | 
 | 288 | template <class _T1, class _T2> | 
 | 289 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 290 | bool | 
 | 291 | operator< (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) | 
 | 292 | { | 
 | 293 |     return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second); | 
 | 294 | } | 
 | 295 |  | 
 | 296 | template <class _T1, class _T2> | 
 | 297 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 298 | bool | 
 | 299 | operator> (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) | 
 | 300 | { | 
 | 301 |     return __y < __x; | 
 | 302 | } | 
 | 303 |  | 
 | 304 | template <class _T1, class _T2> | 
 | 305 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 306 | bool | 
 | 307 | operator>=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) | 
 | 308 | { | 
 | 309 |     return !(__x < __y); | 
 | 310 | } | 
 | 311 |  | 
 | 312 | template <class _T1, class _T2> | 
 | 313 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 314 | bool | 
 | 315 | operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) | 
 | 316 | { | 
 | 317 |     return !(__y < __x); | 
 | 318 | } | 
 | 319 |  | 
 | 320 | template <class _T1, class _T2> | 
 | 321 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 322 | void | 
 | 323 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | 
 | 324 | { | 
 | 325 |     swap(__x.first, __y.first); | 
 | 326 |     swap(__x.second, __y.second); | 
 | 327 | } | 
 | 328 |  | 
 | 329 | #ifdef _LIBCPP_MOVE | 
 | 330 |  | 
 | 331 | template <class _Tp> class reference_wrapper; | 
 | 332 |  | 
 | 333 | template <class _Tp> | 
 | 334 | struct ___make_pair_return | 
 | 335 | { | 
 | 336 |     typedef _Tp type; | 
 | 337 | }; | 
 | 338 |  | 
 | 339 | template <class _Tp> | 
 | 340 | struct ___make_pair_return<reference_wrapper<_Tp>> | 
 | 341 | { | 
 | 342 |     typedef _Tp& type; | 
 | 343 | }; | 
 | 344 |  | 
 | 345 | template <class _Tp> | 
 | 346 | struct __make_pair_return | 
 | 347 | { | 
 | 348 |     typedef typename ___make_pair_return<typename decay<_Tp>::type>::type type; | 
 | 349 | }; | 
 | 350 |  | 
 | 351 | template <class _T1, class _T2> | 
 | 352 | inline | 
 | 353 | pair<typename __make_pair_return<_T1>::type, typename __make_pair_return<_T2>::type> | 
 | 354 | make_pair(_T1&& __t1, _T2&& __t2) | 
 | 355 | { | 
 | 356 |     return pair<typename __make_pair_return<_T1>::type, typename __make_pair_return<_T2>::type> | 
 | 357 |                (_STD::forward<_T1>(__t1), _STD::forward<_T2>(__t2)); | 
 | 358 | } | 
 | 359 |  | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame^] | 360 | #else  // _LIBCPP_MOVE | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 361 |  | 
 | 362 | template <class _T1, class _T2> | 
 | 363 | inline _LIBCPP_INLINE_VISIBILITY | 
 | 364 | pair<_T1,_T2> | 
 | 365 | make_pair(_T1 __x, _T2 __y) | 
 | 366 | { | 
 | 367 |     return pair<_T1, _T2>(__x, __y); | 
 | 368 | } | 
 | 369 |  | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame^] | 370 | #endif  // _LIBCPP_MOVE | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 371 |  | 
 | 372 | #ifndef _LIBCPP_HAS_NO_VARIADICS | 
 | 373 |  | 
 | 374 | template <class _T1, class _T2> | 
 | 375 |   class tuple_size<pair<_T1, _T2> > : public integral_constant<size_t, 2> {}; | 
 | 376 |  | 
 | 377 | template <class _T1, class _T2> | 
 | 378 |   class tuple_size<const pair<_T1, _T2> > : public integral_constant<size_t, 2> {}; | 
 | 379 |  | 
 | 380 | template <class _T1, class _T2> | 
 | 381 | class tuple_element<0, pair<_T1, _T2> > | 
 | 382 | { | 
 | 383 | public: | 
 | 384 |     typedef _T1 type; | 
 | 385 | }; | 
 | 386 |  | 
 | 387 | template <class _T1, class _T2> | 
 | 388 | class tuple_element<1, pair<_T1, _T2> > | 
 | 389 | { | 
 | 390 | public: | 
 | 391 |     typedef _T2 type; | 
 | 392 | }; | 
 | 393 |  | 
 | 394 | template <class _T1, class _T2> | 
 | 395 | class tuple_element<0, const pair<_T1, _T2> > | 
 | 396 | { | 
 | 397 | public: | 
 | 398 |     typedef const _T1 type; | 
 | 399 | }; | 
 | 400 |  | 
 | 401 | template <class _T1, class _T2> | 
 | 402 | class tuple_element<1, const pair<_T1, _T2> > | 
 | 403 | { | 
 | 404 | public: | 
 | 405 |     typedef const _T2 type; | 
 | 406 | }; | 
 | 407 |  | 
 | 408 | template <size_t _Ip> struct __get_pair; | 
 | 409 |  | 
 | 410 | template <> | 
 | 411 | struct __get_pair<0> | 
 | 412 | { | 
 | 413 |     template <class _T1, class _T2> | 
 | 414 |     static | 
 | 415 |     _LIBCPP_INLINE_VISIBILITY | 
 | 416 |     _T1& | 
 | 417 |     get(pair<_T1, _T2>& __p) {return __p.first;} | 
 | 418 |  | 
 | 419 |     template <class _T1, class _T2> | 
 | 420 |     static | 
 | 421 |     _LIBCPP_INLINE_VISIBILITY | 
 | 422 |     const _T1& | 
 | 423 |     get(const pair<_T1, _T2>& __p) {return __p.first;} | 
 | 424 | }; | 
 | 425 |  | 
 | 426 | template <> | 
 | 427 | struct __get_pair<1> | 
 | 428 | { | 
 | 429 |     template <class _T1, class _T2> | 
 | 430 |     static | 
 | 431 |     _LIBCPP_INLINE_VISIBILITY | 
 | 432 |     _T2& | 
 | 433 |     get(pair<_T1, _T2>& __p) {return __p.second;} | 
 | 434 |  | 
 | 435 |     template <class _T1, class _T2> | 
 | 436 |     static | 
 | 437 |     _LIBCPP_INLINE_VISIBILITY | 
 | 438 |     const _T2& | 
 | 439 |     get(const pair<_T1, _T2>& __p) {return __p.second;} | 
 | 440 | }; | 
 | 441 |  | 
 | 442 | template <size_t _Ip, class _T1, class _T2> | 
 | 443 | _LIBCPP_INLINE_VISIBILITY inline | 
 | 444 | typename tuple_element<_Ip, pair<_T1, _T2> >::type& | 
 | 445 | get(pair<_T1, _T2>& __p) | 
 | 446 | { | 
 | 447 |     return __get_pair<_Ip>::get(__p); | 
 | 448 | } | 
 | 449 |  | 
 | 450 | template <size_t _Ip, class _T1, class _T2> | 
 | 451 | _LIBCPP_INLINE_VISIBILITY inline | 
 | 452 | const typename tuple_element<_Ip, pair<_T1, _T2> >::type& | 
 | 453 | get(const pair<_T1, _T2>& __p) | 
 | 454 | { | 
 | 455 |     return __get_pair<_Ip>::get(__p); | 
 | 456 | } | 
 | 457 |  | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame^] | 458 | #endif  // _LIBCPP_HAS_NO_VARIADICS | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 459 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 460 | _LIBCPP_END_NAMESPACE_STD | 
 | 461 |  | 
 | 462 | #endif  // _LIBCPP_UTILITY |