mirror of
https://github.com/dlang/phobos.git
synced 2025-05-05 01:20:40 +03:00
16 lines
669 B
Text
16 lines
669 B
Text
Added `std.meta.staticIsSorted` to check if an `AliasSeq` is sorted according to some template predicate.
|
|
|
|
`std.meta.staticIsSorted` checks whether an `AliasSeq` is
|
|
sorted according to some template predicate.
|
|
------
|
|
enum Comp(T1, T2) = T1.sizeof < T2.sizeof;
|
|
|
|
import std.meta : staticIsSorted;
|
|
static assert( staticIsSorted!(Comp, byte, uint, double));
|
|
static assert(!staticIsSorted!(Comp, bool, long, dchar));
|
|
------
|
|
|
|
Additionally, the compile-time performance of `std.meta.staticSort` has been
|
|
greatly improved. Nevertheless, due to compiler limitations it is still an
|
|
extraordinarily expensive operation to perform on longer sequences; strive to
|
|
minimize such use.
|