cppcore
A small, portable C++ core library
Loading...
Searching...
No Matches
Sort.h File Reference
Include dependency graph for Sort.h:

Go to the source code of this file.

Namespaces

namespace  cppcore

Typedefs

typedef int32_t(* cppcore::ComparisonFn) (const void *_lhs, const void *_rhs)
 The comparison function type.

Functions

template<class T>
int32_t cppcore::compAscending (const void *lhs, const void *rhs)
 Compare two values in ascending order.
template<typename Ty>
int32_t cppcore::compDescending (const void *_lhs, const void *_rhs)
 Compare two values in descending order.
template<class T>
void cppcore::swap (T &v1, T &v2)
 Swaps two POD values.
void cppcore::swap (uint8_t &lhs, uint8_t &rhs)
 Swaps two uint8 values.
void cppcore::swap (void *v1, void *v2, size_t stride)
 Swaps two POD values bitwise.
void cppcore::quicksortImpl (void *pivot, void *_data, size_t num, size_t stride, ComparisonFn func)
 Implements the quicksort algorithm.
void cppcore::quicksort (void *_data, size_t num, size_t stride, ComparisonFn func)
 Implements the quicksort algorithm.
bool cppcore::isSorted (const void *data, size_t num, size_t stride, ComparisonFn func)
 Checks if the data is sorted.
int32_t cppcore::binSearchImpl (const void *key, const void *data, size_t num, size_t stride, ComparisonFn func)
 Implements a binary search algorithm.
template<class T>
int32_t cppcore::binSearch (const T &key, const void *array, size_t num, ComparisonFn func)
 Implements a binary search algorithm.