template<typename T, typename ARRAY = BaseArraySelector<>, typename COMPARE = DefaultCompare, Bool KEEP_DUPLICATES = false, Bool MINIMAL = false>
class maxon::MaximalElements< T, ARRAY, COMPARE, KEEP_DUPLICATES, MINIMAL >
MaximalElements finds the maximal elements of a set of values with a partial order. A maximal element of such a set is an element which is not less than any other element of the set. A partially ordered set may have more than one maximal element.
To use MaximalElements, add all values via the Append function. Afterwards, you can use MaximalElements like an array, it then will contain the maximal elements of all added values.
For comparison, MaximalElements uses the operator < and <= on the values by default (or just < when KEEP_DUPLICATES is true), but you can override this with the #COMPARE parameter.
- Template Parameters
-
T | The type of values. There has to be a partial order on T defined by COMPARE. |
ARRAY | An array selector template to choose the array implementation to use. |
COMPARE | The static LessThan and LessThanOrEqual functions of COMPARE are used for value comparisons. When KEEP_DUPLICATES is true, only LessThan needs to be present. |
KEEP_DUPLICATES | If true, elements of the set which are equal will be kept each in the array, otherwise only one of them will be in the array. |
MINIMAL | If true, find the minimal elements instead. Still only < and <= are used. |
- See also
- MinimalElements