OLD | NEW |
(Empty) | |
| 1 //===----------------------- algorithm.cpp --------------------------------===// |
| 2 // |
| 3 // The LLVM Compiler Infrastructure |
| 4 // |
| 5 // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 // Source Licenses. See LICENSE.TXT for details. |
| 7 // |
| 8 //===----------------------------------------------------------------------===// |
| 9 |
| 10 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; |
| 11 #include "algorithm" |
| 12 #include "random" |
| 13 #include "mutex" |
| 14 |
| 15 _LIBCPP_BEGIN_NAMESPACE_STD |
| 16 |
| 17 template void __sort<__less<char>&, char*>(char*, char*, __less<char>&); |
| 18 template void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wcha
r_t>&); |
| 19 template void __sort<__less<signed char>&, signed char*>(signed char*, signed ch
ar*, __less<signed char>&); |
| 20 template void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, uns
igned char*, __less<unsigned char>&); |
| 21 template void __sort<__less<short>&, short*>(short*, short*, __less<short>&); |
| 22 template void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*,
unsigned short*, __less<unsigned short>&); |
| 23 template void __sort<__less<int>&, int*>(int*, int*, __less<int>&); |
| 24 template void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<
unsigned>&); |
| 25 template void __sort<__less<long>&, long*>(long*, long*, __less<long>&); |
| 26 template void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, uns
igned long*, __less<unsigned long>&); |
| 27 template void __sort<__less<long long>&, long long*>(long long*, long long*, __l
ess<long long>&); |
| 28 template void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned
long long*, unsigned long long*, __less<unsigned long long>&); |
| 29 template void __sort<__less<float>&, float*>(float*, float*, __less<float>&); |
| 30 template void __sort<__less<double>&, double*>(double*, double*, __less<double>&
); |
| 31 template void __sort<__less<long double>&, long double*>(long double*, long doub
le*, __less<long double>&); |
| 32 |
| 33 template bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __
less<char>&); |
| 34 template bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*,
wchar_t*, __less<wchar_t>&); |
| 35 template bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(si
gned char*, signed char*, __less<signed char>&); |
| 36 template bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*
>(unsigned char*, unsigned char*, __less<unsigned char>&); |
| 37 template bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*
, __less<short>&); |
| 38 template bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned shor
t*>(unsigned short*, unsigned short*, __less<unsigned short>&); |
| 39 template bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less
<int>&); |
| 40 template bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned
*, unsigned*, __less<unsigned>&); |
| 41 template bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __
less<long>&); |
| 42 template bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*
>(unsigned long*, unsigned long*, __less<unsigned long>&); |
| 43 template bool __insertion_sort_incomplete<__less<long long>&, long long*>(long l
ong*, long long*, __less<long long>&); |
| 44 template bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned
long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>
&); |
| 45 template bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*
, __less<float>&); |
| 46 template bool __insertion_sort_incomplete<__less<double>&, double*>(double*, dou
ble*, __less<double>&); |
| 47 template bool __insertion_sort_incomplete<__less<long double>&, long double*>(lo
ng double*, long double*, __less<long double>&); |
| 48 |
| 49 template unsigned __sort5<__less<long double>&, long double*>(long double*, long
double*, long double*, long double*, long double*, __less<long double>&); |
| 50 |
| 51 static pthread_mutex_t __rs_mut = PTHREAD_MUTEX_INITIALIZER; |
| 52 unsigned __rs_default::__c_ = 0; |
| 53 |
| 54 __rs_default::__rs_default() |
| 55 { |
| 56 pthread_mutex_lock(&__rs_mut); |
| 57 __c_ = 1; |
| 58 } |
| 59 |
| 60 __rs_default::__rs_default(const __rs_default&) |
| 61 { |
| 62 ++__c_; |
| 63 } |
| 64 |
| 65 __rs_default::~__rs_default() |
| 66 { |
| 67 if (--__c_ == 0) |
| 68 pthread_mutex_unlock(&__rs_mut); |
| 69 } |
| 70 |
| 71 __rs_default::result_type |
| 72 __rs_default::operator()() |
| 73 { |
| 74 static mt19937 __rs_g; |
| 75 return __rs_g(); |
| 76 } |
| 77 |
| 78 __rs_default |
| 79 __rs_get() |
| 80 { |
| 81 return __rs_default(); |
| 82 } |
| 83 |
| 84 _LIBCPP_END_NAMESPACE_STD |
OLD | NEW |