July 16, 2021

Is there room for a compile-time variant of Partition in std.meta?

Partition is an in-place algorithm in Phobos so maybe Partitioned would be a more suitable name.

As a replacement for patterns such as

import std.meta : Filter, templateNot;
alias X = Filter!(isX, Ts);
alias UnX = Filter!(templateNot!isX, Ts);

Not sure about the ordering requirement. Probably not of interest in the compile-time case.

Also see std.algorithm.sorting.partition.