C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2
tool_quick_sort.h File Reference

A sorting function. More...

#include <io_define.h>
#include <math_define.h>

Namespaces

 c3d
 C3D namespace declaration.
 

Functions

void KsQSort (void *base, size_t num, size_t width, KsQSortCompFunc compareFunc)
 An array sorting. More...
 
template<class Type >
void Swap (Type *arr, size_t ind1, size_t ind2)
 Swapping of 2 elements in the array. More...
 
template<class Type , class Type2 , class Type3 >
void InsertSort (Type *base, size_t num, KsQSortCompFunc compareFunc, Type2 *base2=nullptr, Type3 *base3=nullptr)
 An array sorting with an ability of synchronous rearrangement in two other specified arrays. Effective for small arrays. More...
 
template<class Type , class Type2 , class Type3 >
void QuickSort (Type *base, size_t num, KsQSortCompFunc compareFunc, Type2 *base2=nullptr, Type3 *base3=nullptr)
 An array sorting with an ability of synchronous rearrangement in two other specified arrays. Works with arrays of elements which support assignment operators. Not guarantees preserving of the order of equal elements. More...
 
size_t KsAutoDelta (size_t count)
 A function of automatic allocating of the memory. More...
 

Detailed Description

A sorting function.

Function Documentation

◆ KsQSort()

void KsQSort ( void base,
size_t  num,
size_t  width,
KsQSortCompFunc  compareFunc 
)
inline

An array sorting.

Implements a quicksort of the array of elements. Sorts in place.

Parameters
[out]base- Pointer to the base of the array.
[in]num- Number of elements in the array.
[in]width- Size in bytes of the array element.
[in]compareFunc- Pointer to the comparison function for the elements of the first array. Analog of strcmp for strings, supplied by user for comparing the array elements. Accepts 2 pointers to elements and returns: negative value, if 1<2; 0, if 1=2; positive value, if 1>2.

◆ KsAutoDelta()

size_t KsAutoDelta ( size_t  count)
inline

A function of automatic allocating of the memory.

This function is used for the template library Sys for the automatic allocation of the memory in SArray, RPArray, SQueue ...