View source code
							
							
						
								Display the source code in std/algorithm/sorting.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								Improve this page
							
							
					
								Quickly fork, edit online, and submit a pull request for this page.
								Requires a signed-in GitHub account. This works well for small changes.
								If you'd like to make larger changes you may want to consider using
								local clone.
							
						Function std.algorithm.sorting.topNIndex
Given a range of elements, constructs an index of its top n elements (i.e., the first n elements if the range were sorted).
						
				void topNIndex(alias less, SwapStrategy ss = SwapStrategy
				  Range r,
				
				  RangeIndex index,
				
				  SortOutput sorted = No
				)
				
				if (isRandomAccessRange!Range && isRandomAccessRange!RangeIndex && hasAssignableElements!RangeIndex);
						
					
				Similar to topN, except that the range is not modified.
Parameters
| Name | Description | 
|---|---|
| less | A binary predicate that defines the ordering of range elements.
        Defaults to a < b. | 
| ss | (Not implemented yet.) Specify the swapping strategy. | 
| r | A random-access range of elements to make an index for. | 
| index | A
        random-access range
        with assignable elements to build the index in. The length of this range
        determines how many top elements to index in r.
        This index range can either have integral elements, in which case the
        constructed index will consist of zero-based numerical indices intor; or it can have pointers to the element type ofr, in which
        case the constructed index will be pointers to the top elements inr. | 
| sorted | Determines whether to sort the index by the elements they refer to. | 
See also
BUGS
The swapping strategy parameter is not implemented yet; currently it is ignored.
Example
import stdAuthors
License
					Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.