1227825Stheraven//===----------------------- algorithm.cpp --------------------------------===//
2227825Stheraven//
3227825Stheraven//                     The LLVM Compiler Infrastructure
4227825Stheraven//
5227825Stheraven// This file is dual licensed under the MIT and the University of Illinois Open
6227825Stheraven// Source Licenses. See LICENSE.TXT for details.
7227825Stheraven//
8227825Stheraven//===----------------------------------------------------------------------===//
9227825Stheraven
10227825Stheraven#include "algorithm"
11227825Stheraven#include "random"
12227825Stheraven#include "mutex"
13227825Stheraven
14227825Stheraven_LIBCPP_BEGIN_NAMESPACE_STD
15227825Stheraven
16227825Stheraventemplate void __sort<__less<char>&, char*>(char*, char*, __less<char>&);
17227825Stheraventemplate void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
18227825Stheraventemplate void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
19227825Stheraventemplate void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
20227825Stheraventemplate void __sort<__less<short>&, short*>(short*, short*, __less<short>&);
21227825Stheraventemplate void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
22227825Stheraventemplate void __sort<__less<int>&, int*>(int*, int*, __less<int>&);
23227825Stheraventemplate void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
24227825Stheraventemplate void __sort<__less<long>&, long*>(long*, long*, __less<long>&);
25227825Stheraventemplate void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
26227825Stheraventemplate void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
27227825Stheraventemplate void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&);
28227825Stheraventemplate void __sort<__less<float>&, float*>(float*, float*, __less<float>&);
29227825Stheraventemplate void __sort<__less<double>&, double*>(double*, double*, __less<double>&);
30227825Stheraventemplate void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
31227825Stheraven
32227825Stheraventemplate bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&);
33227825Stheraventemplate bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
34227825Stheraventemplate bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
35227825Stheraventemplate bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
36227825Stheraventemplate bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&);
37227825Stheraventemplate bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
38227825Stheraventemplate bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&);
39227825Stheraventemplate bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
40227825Stheraventemplate bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&);
41227825Stheraventemplate bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
42227825Stheraventemplate bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
43227825Stheraventemplate bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&);
44227825Stheraventemplate bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&);
45227825Stheraventemplate bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&);
46227825Stheraventemplate bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
47227825Stheraven
48227825Stheraventemplate unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&);
49227825Stheraven
50278724Sdim#ifndef _LIBCPP_HAS_NO_THREADS
51227825Stheravenstatic pthread_mutex_t __rs_mut = PTHREAD_MUTEX_INITIALIZER;
52278724Sdim#endif
53227825Stheravenunsigned __rs_default::__c_ = 0;
54227825Stheraven
55227825Stheraven__rs_default::__rs_default()
56227825Stheraven{
57278724Sdim#ifndef _LIBCPP_HAS_NO_THREADS
58227825Stheraven    pthread_mutex_lock(&__rs_mut);
59278724Sdim#endif
60227825Stheraven    __c_ = 1;
61227825Stheraven}
62227825Stheraven
63227825Stheraven__rs_default::__rs_default(const __rs_default&)
64227825Stheraven{
65227825Stheraven    ++__c_;
66227825Stheraven}
67227825Stheraven
68227825Stheraven__rs_default::~__rs_default()
69227825Stheraven{
70278724Sdim#ifndef _LIBCPP_HAS_NO_THREADS
71227825Stheraven    if (--__c_ == 0)
72227825Stheraven        pthread_mutex_unlock(&__rs_mut);
73278724Sdim#else
74278724Sdim    --__c_;
75278724Sdim#endif
76227825Stheraven}
77227825Stheraven
78227825Stheraven__rs_default::result_type
79227825Stheraven__rs_default::operator()()
80227825Stheraven{
81227825Stheraven    static mt19937 __rs_g;
82227825Stheraven    return __rs_g();
83227825Stheraven}
84227825Stheraven
85227825Stheraven__rs_default
86227825Stheraven__rs_get()
87227825Stheraven{
88227825Stheraven    return __rs_default();
89227825Stheraven}
90227825Stheraven
91227825Stheraven_LIBCPP_END_NAMESPACE_STD
92