sortingPredicate

Given a SortedRange R, sortingPredicate!R(a, b) will call in to the predicate that was used to create the SortedRange

Members

Aliases

R
alias R = TypesOf!Args[0]
Undocumented in source.
pred
alias pred = binaryFun!(Args[1])
Undocumented in source.
sortingPredicate
alias sortingPredicate = binaryFun!(P[1])
Undocumented in source.
sortingPredicate
alias sortingPredicate = pred
Undocumented in source.

Examples

import std.algorithm: sort;

// As a type
assert(sortingPredicate!(typeof([1].sort!"a < b"))(1, 2) == true);
assert(sortingPredicate!(typeof([1].sort!((a, b) => a > b)))(1, 2) == false);

// As a value
assert(sortingPredicate!([1].sort!"a > b")(1, 2) == false);
assert(sortingPredicate!([1].sort!((a, b) => a < b))(1, 2) == true);

// Default predicate
assert(sortingPredicate!(int[])(1, 2) == true);

Meta