14684ddb6SLionel Sambuc //===----------------------- algorithm.cpp --------------------------------===//
24684ddb6SLionel Sambuc //
34684ddb6SLionel Sambuc // The LLVM Compiler Infrastructure
44684ddb6SLionel Sambuc //
54684ddb6SLionel Sambuc // This file is dual licensed under the MIT and the University of Illinois Open
64684ddb6SLionel Sambuc // Source Licenses. See LICENSE.TXT for details.
74684ddb6SLionel Sambuc //
84684ddb6SLionel Sambuc //===----------------------------------------------------------------------===//
94684ddb6SLionel Sambuc
104684ddb6SLionel Sambuc #include "algorithm"
114684ddb6SLionel Sambuc #include "random"
124684ddb6SLionel Sambuc #include "mutex"
134684ddb6SLionel Sambuc
144684ddb6SLionel Sambuc _LIBCPP_BEGIN_NAMESPACE_STD
154684ddb6SLionel Sambuc
164684ddb6SLionel Sambuc template void __sort<__less<char>&, char*>(char*, char*, __less<char>&);
174684ddb6SLionel Sambuc template void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
184684ddb6SLionel Sambuc template void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
194684ddb6SLionel Sambuc template void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
204684ddb6SLionel Sambuc template void __sort<__less<short>&, short*>(short*, short*, __less<short>&);
214684ddb6SLionel Sambuc template void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
224684ddb6SLionel Sambuc template void __sort<__less<int>&, int*>(int*, int*, __less<int>&);
234684ddb6SLionel Sambuc template void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
244684ddb6SLionel Sambuc template void __sort<__less<long>&, long*>(long*, long*, __less<long>&);
254684ddb6SLionel Sambuc template void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
264684ddb6SLionel Sambuc template void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
274684ddb6SLionel Sambuc template void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&);
284684ddb6SLionel Sambuc template void __sort<__less<float>&, float*>(float*, float*, __less<float>&);
294684ddb6SLionel Sambuc template void __sort<__less<double>&, double*>(double*, double*, __less<double>&);
304684ddb6SLionel Sambuc template void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
314684ddb6SLionel Sambuc
324684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&);
334684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
344684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
354684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
364684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&);
374684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
384684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&);
394684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
404684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&);
414684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
424684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
434684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&);
444684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&);
454684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&);
464684ddb6SLionel Sambuc template bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
474684ddb6SLionel Sambuc
484684ddb6SLionel Sambuc template unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&);
494684ddb6SLionel Sambuc
50*0a6a1f1dSLionel Sambuc #ifndef _LIBCPP_HAS_NO_THREADS
514684ddb6SLionel Sambuc static pthread_mutex_t __rs_mut = PTHREAD_MUTEX_INITIALIZER;
52*0a6a1f1dSLionel Sambuc #endif
534684ddb6SLionel Sambuc unsigned __rs_default::__c_ = 0;
544684ddb6SLionel Sambuc
__rs_default()554684ddb6SLionel Sambuc __rs_default::__rs_default()
564684ddb6SLionel Sambuc {
57*0a6a1f1dSLionel Sambuc #ifndef _LIBCPP_HAS_NO_THREADS
584684ddb6SLionel Sambuc pthread_mutex_lock(&__rs_mut);
59*0a6a1f1dSLionel Sambuc #endif
604684ddb6SLionel Sambuc __c_ = 1;
614684ddb6SLionel Sambuc }
624684ddb6SLionel Sambuc
__rs_default(const __rs_default &)634684ddb6SLionel Sambuc __rs_default::__rs_default(const __rs_default&)
644684ddb6SLionel Sambuc {
654684ddb6SLionel Sambuc ++__c_;
664684ddb6SLionel Sambuc }
674684ddb6SLionel Sambuc
~__rs_default()684684ddb6SLionel Sambuc __rs_default::~__rs_default()
694684ddb6SLionel Sambuc {
70*0a6a1f1dSLionel Sambuc #ifndef _LIBCPP_HAS_NO_THREADS
714684ddb6SLionel Sambuc if (--__c_ == 0)
724684ddb6SLionel Sambuc pthread_mutex_unlock(&__rs_mut);
73*0a6a1f1dSLionel Sambuc #else
74*0a6a1f1dSLionel Sambuc --__c_;
75*0a6a1f1dSLionel Sambuc #endif
764684ddb6SLionel Sambuc }
774684ddb6SLionel Sambuc
784684ddb6SLionel Sambuc __rs_default::result_type
operator ()()794684ddb6SLionel Sambuc __rs_default::operator()()
804684ddb6SLionel Sambuc {
814684ddb6SLionel Sambuc static mt19937 __rs_g;
824684ddb6SLionel Sambuc return __rs_g();
834684ddb6SLionel Sambuc }
844684ddb6SLionel Sambuc
854684ddb6SLionel Sambuc __rs_default
__rs_get()864684ddb6SLionel Sambuc __rs_get()
874684ddb6SLionel Sambuc {
884684ddb6SLionel Sambuc return __rs_default();
894684ddb6SLionel Sambuc }
904684ddb6SLionel Sambuc
914684ddb6SLionel Sambuc _LIBCPP_END_NAMESPACE_STD
92