-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSort.h
31 lines (24 loc) · 961 Bytes
/
Sort.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once
#include <vector>
using namespace std;
namespace FW
{
typedef bool (*SortCompareFunc) (void* data, int idxA, int idxB); // Returns true if A should come before B.
typedef void (*SortSwapFunc) (void* data, int idxA, int idxB); // Swaps A and B.
void sort(void* data, int start, int end, SortCompareFunc compareFunc, SortSwapFunc swapFunc, bool multicore = false);
template <class T> void sort(vector<T>& data, int start, int end, SortCompareFunc compareFunc, SortSwapFunc swapFunc, bool multicore = false);
//------------------------------------------------------------------------
template <class T> void sort(vector<T>& data, int start, int end, SortCompareFunc compareFunc, SortSwapFunc swapFunc, bool multicore)
{
sort(&data[start], 0, end - start, compareFunc, swapFunc, multicore);
}
//------------------------------------------------------------------------
}
/*
class Sort
{
public:
Sort(void);
~Sort(void);
};
*/