Algorithm Conventions

The descriptions of the algorithm template functions employ several shorthand phrases:

Several algorithms make use of a predicate, using operator==, that must impose an equivalence relationship on pairs of elements from a sequence. For all elements X, Y, and Z:

Several algorithms make use of a predicate that must impose a strict weak ordering on pairs of elements from a sequence. For the predicate pr(X, Y):

Some of these algorithms implicitly use the predicate X < Y. Other predicates that typically satisfy the ``strict weak ordering'' requirement are X > Y, less(X, Y), and greater(X, Y). Note, however, that predicates such as X <= Y and X >= Y do not satisfy this requirement.

A sequence of elements designated by iterators in the range [first, last) is ``a sequence ordered by operator<'' if, for each N in the range [0, last - first) and for each M in the range (N, last - first) the predicate !(*(first + M) < *(first + N)) is true. (Note that the elements are sorted in ascending order.) The predicate function operator<, or any replacement for it, must not alter either of its operands. Moreover, it must impose a strict weak ordering on the operands it compares.

A sequence of elements designated by iterators in the range [first, last) is ``a heap ordered by operator<'' if, for each N in the range [1, last - first) the predicate !(*first < *(first + N)) is true. (The first element is the largest.) Its internal structure is otherwise known only to the template functions make_heap, pop_heap, and push_heap. As with an ordered sequence, the predicate function operator<, or any replacement for it, must not alter either of its operands, and it must impose a strict weak ordering on the operands it compares.

Copyright note

Certain materials included or referred to in this document are copyright P.J. Plauger and/or Dinkumware, Ltd. or are based on materials that are copyright P.J. Plauger and/or Dinkumware, Ltd.

Notwithstanding the meta-data for this document, copyright information for this document is as follows:

Copyright © IBM Corp. 1999, 2014. & Copyright © P.J. Plauger and/or Dinkumware, Ltd. 1992-2006.