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.partition3
Rearranges elements in r in three adjacent ranges and returns
them.
						
				auto partition3(alias less, SwapStrategy ss = SwapStrategy
				  Range r,
				
				  E pivot
				
				)
				
				if (ss == SwapStrategy
				The first and leftmost range only contains elements in r
less than pivot. The second and middle range only contains
elements in r that are equal to pivot. Finally, the third
and rightmost range only contains elements in r that are greater
than pivot. The less-than test is defined by the binary function
less.
Parameters
| Name | Description | 
|---|---|
| less | The predicate to use for the rearrangement. | 
| ss | The swapping strategy to use. | 
| r | The random-access range to rearrange. | 
| pivot | The pivot element. | 
Returns
A Tuple of the three resulting ranges. These ranges are
    slices of the original range.
BUGS
stable partition3 has not been implemented yet.
Example
auto a = [ 8, 3, 4, 1, 4, 7, 4 ];
auto pieces = partition3(a, 4);
writeln(pieces[0]); // [1, 3]
writeln(pieces[1]); // [4, 4, 4]
writeln(pieces[2]); // [8, 7]
Authors
License
					Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.