|
10 | 10 | #ifndef _EZCXX_ALGORITHM
|
11 | 11 | #define _EZCXX_ALGORITHM
|
12 | 12 |
|
13 |
| -#include <__config> |
14 |
| - |
15 |
| -// currently unused, but included in the standard |
| 13 | +#include <__eastl_config> |
16 | 14 | #include <initializer_list>
|
| 15 | +#include <EASTL/algorithm.h> |
| 16 | +#include <EASTL/heap.h> |
| 17 | +#include <EASTL/sort.h> |
17 | 18 |
|
18 | 19 | #pragma clang system_header
|
19 | 20 |
|
20 |
| -// very limited implementation of <algorithm> |
21 |
| -// only supports std:max, std::min, and std::clamp |
22 |
| -// these functions can be replaced when <algorithm> is properly implemented |
23 |
| - |
24 |
| -namespace std { |
25 |
| - |
26 |
| -template <class _Tp, class _Compare> _EZCXX_NODISCARD_EXT inline constexpr |
27 |
| -const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) |
28 |
| -{ |
29 |
| - return __comp(__a, __b) ? __b : __a; |
30 |
| -} |
31 |
| - |
32 |
| -template <class _Tp> _EZCXX_NODISCARD_EXT inline constexpr |
33 |
| -const _Tp& max(const _Tp& __a, const _Tp& __b) |
34 |
| -{ |
35 |
| - return (__a < __b) ? __b : __a; |
36 |
| -} |
37 |
| - |
38 |
| -template <class _Tp, class _Compare> _EZCXX_NODISCARD_EXT inline constexpr |
39 |
| -const _Tp& min(const _Tp& __a, const _Tp& __b, _Compare __comp) |
40 |
| -{ |
41 |
| - return __comp(__a, __b) ? __a : __b; |
42 |
| -} |
43 |
| - |
44 |
| -template <class _Tp> _EZCXX_NODISCARD_EXT inline constexpr |
45 |
| -const _Tp& min(const _Tp& __a, const _Tp& __b) |
46 |
| -{ |
47 |
| - return (__a < __b) ? __a : __b; |
48 |
| -} |
49 |
| - |
50 |
| -template <class _Tp, class _Compare> _EZCXX_NODISCARD_EXT inline constexpr |
51 |
| -const _Tp& clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi, _Compare __comp) |
52 |
| -{ |
53 |
| - return __comp(__v, __lo) ? __lo : __comp(__hi, __v) ? __hi : __v; |
54 |
| -} |
55 |
| - |
56 |
| -template <class _Tp> _EZCXX_NODISCARD_EXT inline constexpr |
57 |
| -const _Tp& clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi) |
58 |
| -{ |
59 |
| - return (__v < __lo) ? __lo : (__hi < __v) ? __hi : __v; |
60 |
| -} |
61 |
| - |
62 |
| -} // namespace std |
63 |
| - |
64 | 21 | #endif // _EZCXX_ALGORITHM
|
0 commit comments