Function std.algorithm.searching.maxCount
Computes the minimum (respectively maximum) of range along with its number of
occurrences. Formally, the minimum is a value x in range such that pred(a, x) is false for all values a in range. Conversely, the maximum is
a value x in range such that pred(x, a) is false for all values a
in range (note the swapped arguments to pred).
						
				Tuple!(ElementType!Range,size_t) maxCount(alias pred, Range)
				(
				
				  Range range
				
				)
				
				if (isInputRange!Range && !isInfinite!Range && is(typeof(binaryFun!pred(range
				These functions may be used for computing arbitrary extrema by choosing pred
appropriately. For corrrect functioning, pred must be a strict partial order,
i.e. transitive (if pred(a, b) && pred(b, c) then pred(a, c)) and
irreflexive (pred(a, a) is false). The trichotomy property of
inequality is not required: these algoritms consider elements a and b equal
(for the purpose of counting) if pred puts them in the same equivalence class,
i.e. !pred(a, b) && !pred(b, a).
Parameters
| Name | Description | 
|---|---|
| pred | The ordering predicate to use to determine the extremum (minimum or maximum). | 
| range | The input range to count. | 
Returns
The minimum, respectively maximum element of a range together with the number it occurs in the range.
Throws
Exception if range.
See Also
Example
import std