Quark  0.1
Algorithms Class Reference

A collection of general-purpose algorithms. More...

#include <Algorithms.h++>

Static Public Member Functions

template<typename ITER , typename T , typename LESSTHAN >
static int orderedInsertPosition (ITER begin, ITER end, const T &item, LESSTHAN lessThan=defaultLessThan)
 Returns the insert position for an item in a (presumably sorted) collection. More...
 

Detailed Description

A collection of general-purpose algorithms.

Member Function Documentation

◆ orderedInsertPosition()

static int orderedInsertPosition ( ITER  begin,
ITER  end,
const T &  item,
LESSTHAN  lessThan = defaultLessThan 
)
inlinestatic

Returns the insert position for an item in a (presumably sorted) collection.

This method performs a binary search to determine where to insert the new element such that the sort order of the collection is preserved.

Template Parameters
TThe type of the items in the collection.
Parameters
beginAn iterator pointing to the beginning of the collection.
endAn iterator pointing to the end of the collection.
itemThe item to insert into the collection.
lessThanA function that implements the less-than operation for items of type T.
Returns
The insert position.

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