mirror of
https://github.com/dlang/phobos.git
synced 2025-05-07 11:37:24 +03:00
Switch std.algorithm/.range to lambda syntax
String lambdas are, of course, still supported.
This commit is contained in:
parent
17ba4bb594
commit
32eb03a983
2 changed files with 255 additions and 232 deletions
483
std/algorithm.d
483
std/algorithm.d
File diff suppressed because it is too large
Load diff
|
@ -6468,7 +6468,7 @@ enum SearchPolicy
|
||||||
assert(!r.contains(42)); // passes although it shouldn't
|
assert(!r.contains(42)); // passes although it shouldn't
|
||||||
----
|
----
|
||||||
*/
|
*/
|
||||||
struct SortedRange(Range, alias pred = "a < b")
|
struct SortedRange(Range, alias pred = ((a, b) => a < b))
|
||||||
if (isRandomAccessRange!Range)
|
if (isRandomAccessRange!Range)
|
||||||
{
|
{
|
||||||
private alias binaryFun!pred predFun;
|
private alias binaryFun!pred predFun;
|
||||||
|
@ -6979,7 +6979,7 @@ unsorted range failing the test is very high (however, an
|
||||||
almost-sorted range is likely to pass it). To check for sortedness at
|
almost-sorted range is likely to pass it). To check for sortedness at
|
||||||
cost $(BIGOH n), use $(XREF algorithm,isSorted).
|
cost $(BIGOH n), use $(XREF algorithm,isSorted).
|
||||||
*/
|
*/
|
||||||
auto assumeSorted(alias pred = "a < b", R)(R r)
|
auto assumeSorted(alias pred = ((a, b) => a < b), R)(R r)
|
||||||
if (isRandomAccessRange!(Unqual!R))
|
if (isRandomAccessRange!(Unqual!R))
|
||||||
{
|
{
|
||||||
return SortedRange!(Unqual!R, pred)(r);
|
return SortedRange!(Unqual!R, pred)(r);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue