ORIGINAL
Loading...
Searching...
No Matches
original::algorithms Class Referencefinal

Utility class containing generic container algorithms. More...

#include <algorithms.h>

Collaboration diagram for original::algorithms:
Collaboration graph

Public Member Functions

template<typename TYPE>
auto distance (const iterator< TYPE > &end, const iterator< TYPE > &begin) -> integer
 
template<typename TYPE>
original::strongPtr< original::iterator< TYPE > > frontOf (const iterator< TYPE > &it, integer steps)
 
template<typename TYPE>
original::strongPtr< original::iterator< TYPE > > backOf (const iterator< TYPE > &it, integer steps)
 
template<typename TYPE>
auto find (const iterator< TYPE > &begin, const iterator< TYPE > &end, const TYPE &target) -> strongPtr< iterator< TYPE > >
 
template<typename TYPE>
auto find (const iterator< TYPE > &begin, const u_integer n, const TYPE &target) -> strongPtr< iterator< TYPE > >
 
template<typename TYPE, typename Callback>
requires original::Condition<Callback, TYPE>
auto find (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &condition) -> strongPtr< iterator< TYPE > >
 
template<typename TYPE, typename Callback>
requires original::Condition<Callback, TYPE>
auto find (const iterator< TYPE > &begin, const u_integer n, const Callback &condition) -> strongPtr< iterator< TYPE > >
 
template<typename TYPE>
auto count (const iterator< TYPE > &begin, const iterator< TYPE > &end, const TYPE &target) -> u_integer
 
template<typename TYPE, typename Callback>
requires original::Condition<Callback, TYPE>
auto count (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &condition) -> u_integer
 
template<typename TYPE>
auto equal (const iterator< TYPE > &begin1, const iterator< TYPE > &end1, const iterator< TYPE > &begin2, const iterator< TYPE > &end2) -> bool
 
template<typename TYPE, typename Callback>
requires original::Operation<Callback, TYPE>
auto forEach (const iterator< TYPE > &begin, const iterator< TYPE > &end, Callback operation) -> void
 
template<typename TYPE, typename Callback>
requires original::Operation<Callback, TYPE>
auto forEach (const iterator< TYPE > &begin, const u_integer n, Callback operation) -> strongPtr< iterator< TYPE > >
 
template<typename TYPE, typename Callback_O, typename Callback_C>
requires original::Operation<Callback_O, TYPE> && original::Condition<Callback_C, TYPE>
auto forEach (const iterator< TYPE > &begin, const iterator< TYPE > &end, Callback_O operation, const Callback_C &condition) -> void
 
template<typename TYPE, typename Callback_O, typename Callback_C>
requires original::Operation<Callback_O, TYPE> && original::Condition<Callback_C, TYPE>
auto forEach (const iterator< TYPE > &begin, const u_integer n, Callback_O operation, const Callback_C &condition) -> strongPtr< iterator< TYPE > >
 
template<typename TYPE>
auto fill (const iterator< TYPE > &begin, const iterator< TYPE > &end, const TYPE &value) -> void
 
template<typename TYPE>
auto fill (const iterator< TYPE > &begin, const u_integer n, const TYPE &value) -> strongPtr< iterator< TYPE > >
 
template<typename TYPE>
auto swap (const iterator< TYPE > &it1, const iterator< TYPE > &it2) noexcept -> void
 
template<typename TYPE>
auto copy (const iterator< TYPE > &begin_src, const iterator< TYPE > &end_src, const iterator< TYPE > &begin_tar) -> strongPtr< iterator< TYPE > >
 
template<typename TYPE, typename Callback>
requires original::Condition<Callback, TYPE>
auto copy (const iterator< TYPE > &begin_src, const iterator< TYPE > &end_src, const iterator< TYPE > &begin_tar, Callback condition) -> strongPtr< iterator< TYPE > >
 
template<typename TYPE>
auto reverse (const iterator< TYPE > &begin, const iterator< TYPE > &end) -> strongPtr< iterator< TYPE > >
 
template<typename TYPE, typename Callback>
requires original::Compare<Callback, TYPE>
auto compare (const iterator< TYPE > &it1, const iterator< TYPE > &it2, const Callback &compares) -> bool
 
template<typename TYPE, typename Callback>
requires original::Compare<Callback, TYPE>
auto heapAdjustDown (const iterator< TYPE > &begin, const iterator< TYPE > &range, const iterator< TYPE > &current, const Callback &compares) -> void
 
template<typename TYPE, typename Callback>
requires original::Compare<Callback, TYPE>
auto heapAdjustUp (const iterator< TYPE > &begin, const iterator< TYPE > &current, const Callback &compares) -> void
 
template<typename TYPE, typename Callback>
requires original::Compare<Callback, TYPE>
auto heapInit (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &compares) -> void
 
template<typename TYPE, typename Callback>
requires original::Compare<Callback, TYPE>
auto _heapGetPrior (const iterator< TYPE > &begin, const iterator< TYPE > &range, const iterator< TYPE > &parent, const Callback &compares) -> strongPtr< iterator< TYPE > >
 
template<typename TYPE, typename Callback>
requires original::Compare<Callback, TYPE>
original::strongPtr< original::iterator< TYPE > > _introSortGetPivot (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &compares)
 
template<typename TYPE, typename Callback>
requires original::Compare<Callback, TYPE>
original::strongPtr< original::iterator< TYPE > > _introSortPartition (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &compares)
 

Static Public Member Functions

template<typename TYPE>
static integer distance (const iterator< TYPE > &end, const iterator< TYPE > &begin)
 Calculates distance between two iterators.
 
template<typename TYPE>
static strongPtr< iterator< TYPE > > frontOf (const iterator< TYPE > &it, integer steps)
 Gets iterator n steps forward.
 
template<typename TYPE>
static strongPtr< iterator< TYPE > > backOf (const iterator< TYPE > &it, integer steps)
 Gets iterator n steps backward.
 
template<typename TYPE, typename Callback>
requires Condition<Callback, TYPE>
static bool allOf (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &condition)
 Checks if all elements satisfy condition.
 
template<typename TYPE, typename Callback>
requires Condition<Callback, TYPE>
static bool anyOf (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &condition)
 Checks if any elements satisfy condition.
 
template<typename TYPE, typename Callback>
requires Condition<Callback, TYPE>
static bool noneOf (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &condition)
 Checks if no elements satisfy condition.
 
template<typename TYPE>
static strongPtr< iterator< TYPE > > find (const iterator< TYPE > &begin, const iterator< TYPE > &end, const TYPE &target)
 Find first occurrence of target in iterator range.
 
template<typename TYPE>
static strongPtr< iterator< TYPE > > find (const iterator< TYPE > &begin, u_integer n, const TYPE &target)
 Find first element satisfying condition in iterator range.
 
template<typename TYPE, typename Callback>
requires Condition<Callback, TYPE>
static strongPtr< iterator< TYPE > > find (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &condition)
 Find first element satisfying condition in iterator range.
 
template<typename TYPE, typename Callback>
requires Condition<Callback, TYPE>
static strongPtr< iterator< TYPE > > find (const iterator< TYPE > &begin, u_integer n, const Callback &condition)
 Fill range with value (fixed number of elements)
 
template<typename TYPE>
static u_integer count (const iterator< TYPE > &begin, const iterator< TYPE > &end, const TYPE &target)
 Counts occurrences of a target element in the range.
 
template<typename TYPE, typename Callback>
requires Condition<Callback, TYPE>
static u_integer count (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &condition)
 Counts occurrences of elements satisfying condition in the range.
 
template<typename TYPE>
static bool equal (const iterator< TYPE > &begin1, const iterator< TYPE > &end1, const iterator< TYPE > &begin2, const iterator< TYPE > &end2)
 Checks if two iterator ranges are equal.
 
template<typename TYPE, typename Callback>
requires Operation<Callback, TYPE>
static void forEach (const iterator< TYPE > &begin, const iterator< TYPE > &end, Callback operation)
 Applies an operation to each element in the range.
 
template<typename TYPE, typename Callback>
requires Operation<Callback, TYPE>
static strongPtr< iterator< TYPE > > forEach (const iterator< TYPE > &begin, u_integer n, Callback operation)
 Applies an operation to the first n elements in the range.
 
template<typename TYPE, typename Callback_O, typename Callback_C>
requires Operation<Callback_O, TYPE> && Condition<Callback_C, TYPE>
static void forEach (const iterator< TYPE > &begin, const iterator< TYPE > &end, Callback_O operation, const Callback_C &condition)
 Apply operation to elements with condition check.
 
template<typename TYPE, typename Callback_O, typename Callback_C>
requires Operation<Callback_O, TYPE> && Condition<Callback_C, TYPE>
static strongPtr< iterator< TYPE > > forEach (const iterator< TYPE > &begin, u_integer n, Callback_O operation, const Callback_C &condition)
 Conditional forEach with element count limit.
 
template<typename TYPE>
static void fill (const iterator< TYPE > &begin, const iterator< TYPE > &end, const TYPE &value=TYPE{})
 Fills a range with a specific value.
 
template<typename TYPE>
static strongPtr< iterator< TYPE > > fill (const iterator< TYPE > &begin, u_integer n, const TYPE &value=TYPE{})
 Fill range with value (fixed number of elements)
 
template<typename TYPE>
static void swap (const iterator< TYPE > &it1, const iterator< TYPE > &it2) noexcept
 Swaps the values of two elements.
 
template<typename TYPE>
static strongPtr< iterator< TYPE > > copy (const iterator< TYPE > &begin_src, const iterator< TYPE > &end_src, const iterator< TYPE > &begin_tar)
 Copies a range of elements from one iterator to another.
 
template<typename TYPE, typename Callback>
requires Condition<Callback, TYPE>
static strongPtr< iterator< TYPE > > copy (const iterator< TYPE > &begin_src, const iterator< TYPE > &end_src, const iterator< TYPE > &begin_tar, Callback condition=filter< TYPE >{})
 Conditional copy with filtering.
 
template<typename TYPE>
static strongPtr< iterator< TYPE > > reverse (const iterator< TYPE > &begin, const iterator< TYPE > &end)
 Range-based reverse operation.
 
template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static bool compare (const iterator< TYPE > &it1, const iterator< TYPE > &it2, const Callback &compares)
 Compares two elements using a comparison callback.
 
template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static void heapAdjustDown (const iterator< TYPE > &begin, const iterator< TYPE > &range, const iterator< TYPE > &current, const Callback &compares)
 Adjusts a heap structure downwards starting from a given iterator.
 
template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static void heapAdjustUp (const iterator< TYPE > &begin, const iterator< TYPE > &current, const Callback &compares)
 Adjusts a heap structure upwards from a given iterator.
 
template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static void heapInit (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &compares)
 Initializes a heap structure from a range of iterators.
 
template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static void sort (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &compares, bool isStable=false)
 Sorts a range of elements using either stable or unstable sorting algorithm.
 
template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static void introSort (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &compares)
 Sorts a range of elements using introspective sort.
 
template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static void stableSort (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &compares)
 Performs stable hybrid sort on element range.
 
template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static void heapSort (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &compares)
 Sorts a range of elements using heap sort.
 
template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static void insertionSort (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &compares)
 Sorts a range of elements using insertion sort.
 
template<typename TYPE>
static auto distance (const strongPtr< iterator< TYPE > > end, const strongPtr< iterator< TYPE > > begin) -> integer
 Pointer overload version of distance()
 
template<typename TYPE>
static auto frontOf (const strongPtr< iterator< TYPE > > it, integer steps) -> strongPtr< iterator< TYPE > >
 Pointer overload version of frontOf()
 
template<typename TYPE>
static auto backOf (const strongPtr< iterator< TYPE > > it, integer steps) -> strongPtr< iterator< TYPE > >
 Pointer overload version of backOf()
 
template<typename TYPE, typename Callback>
requires original::Condition<Callback, TYPE>
static auto allOf (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > end, const Callback &condition) -> bool
 Pointer overload version of allOf()
 
template<typename TYPE, typename Callback>
requires original::Condition<Callback, TYPE>
static auto anyOf (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > end, const Callback &condition) -> bool
 Pointer overload version of anyOf()
 
template<typename TYPE, typename Callback>
requires original::Condition<Callback, TYPE>
static auto noneOf (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > end, const Callback &condition) -> bool
 Pointer overload version of noneOf()
 
template<typename TYPE>
static auto find (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > end, const TYPE &target) -> strongPtr< iterator< TYPE > >
 Pointer overload version of find()
 
template<typename TYPE>
static auto find (const strongPtr< iterator< TYPE > > begin, u_integer n, const TYPE &target) -> strongPtr< iterator< TYPE > >
 Pointer overload version of find()
 
template<typename TYPE, typename Callback>
requires original::Condition<Callback, TYPE>
static auto find (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > end, const Callback &condition) -> strongPtr< iterator< TYPE > >
 Pointer overload version of find()
 
template<typename TYPE, typename Callback>
requires original::Condition<Callback, TYPE>
static auto find (const strongPtr< iterator< TYPE > > begin, u_integer n, const Callback &condition) -> strongPtr< iterator< TYPE > >
 Pointer overload version of find()
 
template<typename TYPE>
static auto count (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > end, const TYPE &target) -> u_integer
 Pointer overload version of count()
 
template<typename TYPE, typename Callback>
requires original::Condition<Callback, TYPE>
static auto count (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > end, const Callback &condition) -> u_integer
 Pointer overload version of count()
 
template<typename TYPE>
static auto equal (const strongPtr< iterator< TYPE > > begin1, const strongPtr< iterator< TYPE > > end1, const strongPtr< iterator< TYPE > > begin2, const strongPtr< iterator< TYPE > > end2) -> bool
 Pointer overload version of equal()
 
template<typename TYPE, typename Callback>
requires original::Operation<Callback, TYPE>
static auto forEach (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > end, Callback operation) -> void
 Pointer overload version of forEach()
 
template<typename TYPE, typename Callback>
requires original::Operation<Callback, TYPE>
static auto forEach (const strongPtr< iterator< TYPE > > begin, u_integer n, Callback operation) -> strongPtr< iterator< TYPE > >
 Pointer overload version of forEach()
 
template<typename TYPE>
static auto fill (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > end, const TYPE &value) -> void
 Pointer overload version of fill()
 
template<typename TYPE>
static auto fill (const strongPtr< iterator< TYPE > > begin, u_integer n, const TYPE &value) -> strongPtr< iterator< TYPE > >
 Pointer overload version of fill()
 
template<typename TYPE>
static auto swap (const strongPtr< iterator< TYPE > > it1, const strongPtr< iterator< TYPE > > it2) noexcept -> void
 Pointer overload version of swap()
 
template<typename TYPE>
static auto copy (const strongPtr< iterator< TYPE > > begin_src, const strongPtr< iterator< TYPE > > end_src, const strongPtr< iterator< TYPE > > begin_tar) -> strongPtr< iterator< TYPE > >
 Pointer overload version of copy()
 
template<typename TYPE, typename Callback>
requires original::Condition<Callback, TYPE>
static auto copy (const strongPtr< iterator< TYPE > > begin_src, const strongPtr< iterator< TYPE > > end_src, const strongPtr< iterator< TYPE > > begin_tar, Callback condition) -> strongPtr< iterator< TYPE > >
 Pointer overload version of copy()
 
template<typename TYPE>
static auto reverse (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > end) -> strongPtr< iterator< TYPE > >
 Pointer overload version of reverse()
 
template<typename TYPE, typename Callback>
requires original::Compare<Callback, TYPE>
static auto compare (const strongPtr< iterator< TYPE > > it1, const strongPtr< iterator< TYPE > > it2, const Callback &compares) -> bool
 Pointer overload version of compare()
 
template<typename TYPE, typename Callback>
requires original::Compare<Callback, TYPE>
static auto heapAdjustDown (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > range, const strongPtr< iterator< TYPE > > current, const Callback &compares) -> void
 Pointer overload version of heapAdjustDown()
 
template<typename TYPE, typename Callback>
requires original::Compare<Callback, TYPE>
static auto heapAdjustUp (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > current, const Callback &compares) -> void
 Pointer overload version of heapAdjustUp()
 
template<typename TYPE, typename Callback>
requires original::Compare<Callback, TYPE>
static auto heapInit (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > end, const Callback &compares) -> void
 Pointer overload version of heapInit()
 
template<typename TYPE, typename Callback>
requires original::Compare<Callback, TYPE>
static auto heapSort (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > end, const Callback &compares) -> void
 Pointer overload version of heapSort()
 
template<typename TYPE, typename Callback>
requires original::Compare<Callback, TYPE>
static auto insertionSort (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > end, const Callback &compares) -> void
 Pointer overload version of insertionSort()
 

Static Protected Member Functions

template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static strongPtr< iterator< TYPE > > _heapGetPrior (const iterator< TYPE > &begin, const iterator< TYPE > &range, const iterator< TYPE > &parent, const Callback &compares)
 Get parent node's priority child in heap structure.
 
template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static void _stableSortMerge (const iterator< TYPE > &begin, const iterator< TYPE > &mid, const iterator< TYPE > &end, const Callback &compares)
 Merges two sorted sub-ranges during merge sort.
 
template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static void _stableSort (const iterator< TYPE > &begin, const iterator< TYPE > &end, const Callback &compares)
 Recursive implementation of stable sort.
 
template<typename TYPE, typename Callback>
requires original::Compare<Callback, TYPE>
static auto _heapGetPrior (const strongPtr< iterator< TYPE > > begin, const strongPtr< iterator< TYPE > > range, const strongPtr< iterator< TYPE > > parent, const Callback &compares) -> strongPtr< iterator< TYPE > >
 Pointer overload version of _heapGetPrior()
 

Detailed Description

Utility class containing generic container algorithms.

Provides static methods for iterator-based container operations including:

  • Range queries (distance, front/back navigation)
  • Element search/count (find, count, condition checks)
  • Data manipulation (fill, swap, copy, reverse)
  • Heap operations (heapify, adjust, priority comparison)
  • Conditional element processing
  • Generic sorting algorithm

Member Function Documentation

◆ _heapGetPrior()

template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static strongPtr< iterator< TYPE > > original::algorithms::_heapGetPrior ( const iterator< TYPE > & begin,
const iterator< TYPE > & range,
const iterator< TYPE > & parent,
const Callback & compares )
staticprotected

Get parent node's priority child in heap structure.

Template Parameters
TYPEElement type
CallbackComparison callback type
Parameters
beginHeap root iterator
rangeValid heap range boundary
parentParent node iterator
comparesComparison callback
Returns
strongPtr<iterator<TYPE>> Iterator to higher-priority child node @requires Compare<Callback, TYPE>
Note
Protected helper for heap operations

◆ _stableSort()

template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
void original::algorithms::_stableSort ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const Callback & compares )
staticprotected

Recursive implementation of stable sort.

Template Parameters
TYPEElement type
CallbackComparison callback type
Parameters
beginCurrent sub-range start
endCurrent sub-range end
comparesComparison callback

Internal recursive method handling:

  • Base case handling for small ranges
  • Sub-range division
  • Recursive sorting of divided ranges
  • Merge operation invocation
    Note
    Not intended for direct external use

◆ _stableSortMerge()

template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
void original::algorithms::_stableSortMerge ( const iterator< TYPE > & begin,
const iterator< TYPE > & mid,
const iterator< TYPE > & end,
const Callback & compares )
staticprotected

Merges two sorted sub-ranges during merge sort.

Template Parameters
TYPEElement type
CallbackComparison callback type
Parameters
beginStart of first sub-range
midStart of second sub-range (end of first)
endEnd of second sub-range
comparesComparison callback

Key merge step of merge sort algorithm:

  1. Creates temporary storage for merged elements
  2. Sequentially compares elements from both sub-ranges
  3. Copies sorted elements back to original container
    Note
    Requires both input sub-ranges to be pre-sorted

◆ allOf()

template<typename TYPE, typename Callback>
requires Condition<Callback, TYPE>
bool original::algorithms::allOf ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const Callback & condition )
static

Checks if all elements satisfy condition.

Template Parameters
TYPEElement type
CallbackCondition callback type
Parameters
beginStart iterator
endEnd iterator
conditionValidation callback
Returns
bool True if all elements pass condition @requires Condition

◆ anyOf()

template<typename TYPE, typename Callback>
requires Condition<Callback, TYPE>
bool original::algorithms::anyOf ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const Callback & condition )
static

Checks if any elements satisfy condition.

Template Parameters
TYPEElement type
CallbackCondition callback type
Parameters
beginStart iterator
endEnd iterator
conditionValidation callback
Returns
bool True if any element passes condition @requires Condition<Callback, TYPE>

◆ backOf()

template<typename TYPE>
static strongPtr< iterator< TYPE > > original::algorithms::backOf ( const iterator< TYPE > & it,
integer steps )
static

Gets iterator n steps backward.

Template Parameters
TYPEElement type
Parameters
itBase iterator
stepsNumber of steps to retreat
Returns
strongPtr<iterator<TYPE>> New iterator position

◆ compare()

template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static bool original::algorithms::compare ( const iterator< TYPE > & it1,
const iterator< TYPE > & it2,
const Callback & compares )
static

Compares two elements using a comparison callback.

Template Parameters
TYPEElement type
CallbackComparison callback type
Parameters
it1First iterator
it2Second iterator
comparesComparison callback
Returns
bool True if the elements are considered equal by the comparison

◆ copy() [1/2]

template<typename TYPE>
static strongPtr< iterator< TYPE > > original::algorithms::copy ( const iterator< TYPE > & begin_src,
const iterator< TYPE > & end_src,
const iterator< TYPE > & begin_tar )
static

Copies a range of elements from one iterator to another.

Template Parameters
TYPEElement type
Parameters
begin_srcStart iterator of source range
end_srcEnd iterator of source range
begin_tarStart iterator of target range
Returns
strongPtr<iterator<TYPE>> Iterator pointing past the last copied element

◆ copy() [2/2]

template<typename TYPE, typename Callback>
requires Condition<Callback, TYPE>
static strongPtr< iterator< TYPE > > original::algorithms::copy ( const iterator< TYPE > & begin_src,
const iterator< TYPE > & end_src,
const iterator< TYPE > & begin_tar,
Callback condition = filter< TYPE >{} )
static

Conditional copy with filtering.

Template Parameters
TYPEElement type
CallbackCondition callback type
Parameters
begin_srcSource start iterator
end_srcSource end iterator
begin_tarTarget start iterator
conditionFilter condition for elements
Returns
strongPtr<iterator<TYPE>> Iterator past last copied element @requires Condition<Callback, TYPE>

◆ count() [1/2]

template<typename TYPE, typename Callback>
requires Condition<Callback, TYPE>
static u_integer original::algorithms::count ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const Callback & condition )
static

Counts occurrences of elements satisfying condition in the range.

Template Parameters
TYPEElement type
CallbackCondition callback type
Parameters
beginStart iterator
endEnd iterator
conditionValidation callback
Returns
u_integer The number of elements satisfying the condition @requires Condition<Callback, TYPE>

◆ count() [2/2]

template<typename TYPE>
static u_integer original::algorithms::count ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const TYPE & target )
static

Counts occurrences of a target element in the range.

Template Parameters
TYPEElement type
Parameters
beginStart iterator
endEnd iterator
targetValue to count occurrences of
Returns
u_integer The number of occurrences of target in the range

◆ distance()

template<typename TYPE>
static integer original::algorithms::distance ( const iterator< TYPE > & end,
const iterator< TYPE > & begin )
static

Calculates distance between two iterators.

Template Parameters
TYPEElement type
Parameters
endEnding iterator
beginStarting iterator
Returns
integer Number of elements between begin and end (negative if reversed)

◆ equal()

template<typename TYPE>
static bool original::algorithms::equal ( const iterator< TYPE > & begin1,
const iterator< TYPE > & end1,
const iterator< TYPE > & begin2,
const iterator< TYPE > & end2 )
static

Checks if two iterator ranges are equal.

Template Parameters
TYPEElement type
Parameters
begin1Start iterator of the first range
end1End iterator of the first range
begin2Start iterator of the second range
end2End iterator of the second range
Returns
bool True if the ranges are equal, false otherwise

◆ fill() [1/2]

template<typename TYPE>
static void original::algorithms::fill ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const TYPE & value = TYPE{} )
static

Fills a range with a specific value.

Template Parameters
TYPEElement type
Parameters
beginStart iterator
endEnd iterator
valueValue to fill the range with (default constructed if omitted)
Returns
void

◆ fill() [2/2]

template<typename TYPE>
static strongPtr< iterator< TYPE > > original::algorithms::fill ( const iterator< TYPE > & begin,
u_integer n,
const TYPE & value = TYPE{} )
static

Fill range with value (fixed number of elements)

Template Parameters
TYPEElement type
Parameters
beginStart iterator
nNumber of elements to fill
valueValue to fill with (default constructed if omitted)
Returns
strongPtr<iterator<TYPE>> Iterator past last filled element

◆ find() [1/4]

template<typename TYPE, typename Callback>
requires Condition<Callback, TYPE>
static strongPtr< iterator< TYPE > > original::algorithms::find ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const Callback & condition )
static

Find first element satisfying condition in iterator range.

Template Parameters
TYPEElement type
CallbackCondition callback type
Parameters
beginStart iterator
endEnd iterator
conditionSearch condition callback
Returns
strongPtr<iterator<TYPE>> Iterator pointing to found element or end @requires Condition<Callback, TYPE>

◆ find() [2/4]

template<typename TYPE>
static strongPtr< iterator< TYPE > > original::algorithms::find ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const TYPE & target )
static

Find first occurrence of target in iterator range.

Template Parameters
TYPEElement type
Parameters
beginStart iterator
endEnd iterator
targetValue to search for
Returns
strongPtr<iterator<TYPE>> Iterator pointing to found element or end

◆ find() [3/4]

template<typename TYPE, typename Callback>
requires Condition<Callback, TYPE>
static strongPtr< iterator< TYPE > > original::algorithms::find ( const iterator< TYPE > & begin,
u_integer n,
const Callback & condition )
static

Fill range with value (fixed number of elements)

Template Parameters
TYPEElement type
CallbackFinding condition
Parameters
beginStart iterator
nNumber of elements to fill
conditionCondition to find element
Returns
strongPtr<iterator<TYPE>> Iterator past last filled element

◆ find() [4/4]

template<typename TYPE>
static strongPtr< iterator< TYPE > > original::algorithms::find ( const iterator< TYPE > & begin,
u_integer n,
const TYPE & target )
static

Find first element satisfying condition in iterator range.

Template Parameters
TYPEElement type
Parameters
beginStart iterator
nMaximum number of elements to search
targetThe target element to find
Returns
strongPtr<iterator<TYPE>> Iterator pointing to found element or end @requires Condition<Callback, TYPE>

◆ forEach() [1/4]

template<typename TYPE, typename Callback>
requires Operation<Callback, TYPE>
static void original::algorithms::forEach ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
Callback operation )
static

Applies an operation to each element in the range.

Template Parameters
TYPEElement type
CallbackOperation callback type
Parameters
beginStart iterator
endEnd iterator
operationOperation to apply to each element
Returns
void @requires Operation<Callback, TYPE>

◆ forEach() [2/4]

template<typename TYPE, typename Callback_O, typename Callback_C>
requires Operation<Callback_O, TYPE> && Condition<Callback_C, TYPE>
static void original::algorithms::forEach ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
Callback_O operation,
const Callback_C & condition )
static

Apply operation to elements with condition check.

Template Parameters
TYPEElement type
Callback_OOperation callback type
Callback_CCondition callback type
Parameters
beginStart iterator
endEnd iterator
operationOperation to apply
conditionFilter condition for elements @requires Operation<Callback_O, TYPE> && Condition<Callback_C, TYPE>

◆ forEach() [3/4]

template<typename TYPE, typename Callback>
requires Operation<Callback, TYPE>
static strongPtr< iterator< TYPE > > original::algorithms::forEach ( const iterator< TYPE > & begin,
u_integer n,
Callback operation )
static

Applies an operation to the first n elements in the range.

Template Parameters
TYPEElement type
CallbackOperation callback type
Parameters
beginStart iterator
nNumber of elements to process
operationOperation to apply to each element
Returns
strongPtr<iterator<TYPE>> Iterator to the element after the last processed element @requires Operation<Callback, TYPE>

◆ forEach() [4/4]

template<typename TYPE, typename Callback_O, typename Callback_C>
requires Operation<Callback_O, TYPE> && Condition<Callback_C, TYPE>
static strongPtr< iterator< TYPE > > original::algorithms::forEach ( const iterator< TYPE > & begin,
u_integer n,
Callback_O operation,
const Callback_C & condition )
static

Conditional forEach with element count limit.

Template Parameters
TYPEElement type
Callback_OOperation callback type
Callback_CCondition callback type
Parameters
beginStart iterator
nMaximum number of elements to process
operationOperation to apply
conditionFilter condition
Returns
strongPtr<iterator<TYPE>> Iterator past last processed element @requires Operation<Callback_O, TYPE> && Condition<Callback_C, TYPE>

◆ frontOf()

template<typename TYPE>
static strongPtr< iterator< TYPE > > original::algorithms::frontOf ( const iterator< TYPE > & it,
integer steps )
static

Gets iterator n steps forward.

Template Parameters
TYPEElement type
Parameters
itBase iterator
stepsNumber of steps to advance
Returns
strongPtr<iterator<TYPE>> New iterator position

◆ heapAdjustDown()

template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static void original::algorithms::heapAdjustDown ( const iterator< TYPE > & begin,
const iterator< TYPE > & range,
const iterator< TYPE > & current,
const Callback & compares )
static

Adjusts a heap structure downwards starting from a given iterator.

Template Parameters
TYPEElement type
CallbackComparison callback type
Parameters
beginStart iterator of the heap
rangeEnd iterator of the heap
currentIterator of the current element to adjust
comparesComparison callback

◆ heapAdjustUp()

template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static void original::algorithms::heapAdjustUp ( const iterator< TYPE > & begin,
const iterator< TYPE > & current,
const Callback & compares )
static

Adjusts a heap structure upwards from a given iterator.

Template Parameters
TYPEElement type
CallbackComparison callback type
Parameters
beginStart iterator of the heap
currentIterator of the current element to adjust
comparesComparison callback

◆ heapInit()

template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
static void original::algorithms::heapInit ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const Callback & compares )
static

Initializes a heap structure from a range of iterators.

Template Parameters
TYPEElement type
CallbackComparison callback type
Parameters
beginStart iterator of the heap
endEnd iterator of the heap
comparesComparison callback
Returns
void

◆ heapSort()

template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
void original::algorithms::heapSort ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const Callback & compares )
static

Sorts a range of elements using heap sort.

Template Parameters
TYPEElement type
CallbackComparison callback type
Parameters
beginStart iterator of the range
endEnd iterator of the range
comparesComparison callback to define the order

This function performs a heap sort on the elements in the range defined by the iterators begin and end. It first constructs a heap by calling heapInit, and then iteratively swaps the root of the heap with the last element in the range, re-adjusting the heap after each swap. The comparison callback compares is used to determine the order of elements during the sorting process. The sorting is performed in-place.

◆ insertionSort()

template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
void original::algorithms::insertionSort ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const Callback & compares )
static

Sorts a range of elements using insertion sort.

Template Parameters
TYPEElement type
CallbackComparison callback type
Parameters
beginStart iterator of the range
endEnd iterator of the range
comparesComparison callback to define the order

This function performs an insertion sort on the elements in the range defined by the iterators begin and end. It iterates through the elements starting from the second element, inserting each element into its correct position relative to the already sorted portion of the range. The comparison callback compares is used to determine the order of the elements during the sorting process. The sorting is performed in-place.

◆ introSort()

template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
void original::algorithms::introSort ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const Callback & compares )
static

Sorts a range of elements using introspective sort.

Template Parameters
TYPEElement type
CallbackComparison callback type
Parameters
beginStart iterator of the range
endEnd iterator of the range
comparesComparison callback to define the order

This method sorts the elements in the range [begin, end] into ascending order using an introspective sort (a hybrid of quicksort, heapsort, and insertion sort). The order is determined by the provided comparison function.

The algorithm switches to heapsort if the recursion depth exceeds 2*log2(n), ensuring O(n log n) worst-case time complexity. For small partitions (<=16 elements), it uses insertion sort for better cache performance.

Note
The comparison function must provide strict

◆ noneOf()

template<typename TYPE, typename Callback>
requires Condition<Callback, TYPE>
bool original::algorithms::noneOf ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const Callback & condition )
static

Checks if no elements satisfy condition.

Template Parameters
TYPEElement type
CallbackCondition callback type
Parameters
beginStart iterator
endEnd iterator
conditionValidation callback
Returns
bool True if no elements pass condition @requires Condition<Callback, TYPE>

◆ reverse()

template<typename TYPE>
static strongPtr< iterator< TYPE > > original::algorithms::reverse ( const iterator< TYPE > & begin,
const iterator< TYPE > & end )
static

Range-based reverse operation.

Template Parameters
TYPEElement type
Parameters
beginStart iterator
endEnd iterator
Returns
strongPtr<iterator<TYPE>> Iterator to new end of reversed range
Note
Performs in-place reversal of elements

◆ sort()

template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
void original::algorithms::sort ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const Callback & compares,
bool isStable = false )
static

Sorts a range of elements using either stable or unstable sorting algorithm.

Template Parameters
TYPEElement type
CallbackComparison callback type
Parameters
beginStart iterator of the range
endEnd iterator of the range
comparesComparison callback to define the order
isStableFlag indicating whether to use stable sorting (default: false)

This function sorts the elements in the range [begin, end] based on the specified comparison callback. When isStable is set to true, it delegates to stable sort (hybrid of mergesort/insertionSort, see stableSort()) which preserves the relative order of equivalent elements, suitable for scenarios requiring stability. When false (default), it uses introspective sort (hybrid of quicksort/heapSort/insertionSort, see introSort()) which provides O(n log n) worst-case performance but does not preserve element order equality. The choice depends on use-case requirements: Introspective sort (default) is optimal for general-purpose sorting with large datasets Stable sort is explicitly chosen for when stability is required

◆ stableSort()

template<typename TYPE, typename Callback>
requires Compare<Callback, TYPE>
void original::algorithms::stableSort ( const iterator< TYPE > & begin,
const iterator< TYPE > & end,
const Callback & compares )
static

Performs stable hybrid sort on element range.

Template Parameters
TYPEElement type
CallbackComparison callback type
Parameters
beginStart iterator of the range
endEnd iterator of the range
comparesComparison callback for ordering

Implements a stable sort algorithm (a hybrid of merge sort and insertion sort) with O(n log n) time complexity.

  • Preserves original order of equivalent elements
  • Uses insertion sort for small ranges (<=16 elements)
  • Recursively splits and merges sub-ranges
    Note
    Preferred for scenarios requiring stable ordering guarantees

◆ swap()

template<typename TYPE>
static void original::algorithms::swap ( const iterator< TYPE > & it1,
const iterator< TYPE > & it2 )
staticnoexcept

Swaps the values of two elements.

Template Parameters
TYPEElement type
Parameters
it1First element iterator
it2Second element iterator
Returns
void

The documentation for this class was generated from the following file: