castFilter

Variant of std.algorithm.iteration : that filters out all elements of range that are instances of Subclass.

template castFilter(Subclass)
castFilter
(
Range
)
(
Range range
)
if (
isInputRange!(Range) &&
is(ElementType!Range == class)
&&
is(Subclass : ElementType!Range)
)

Members

Functions

castFilter
auto castFilter(Range range)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

class X
{
	this(int x) { this.x = x; }
	int x;
}
class Y : X
{
	this(int x) { super(x); }
}
auto y = castFilter!Y([new X(42), new Y(43)]);
auto yf = y.front;
static assert(is(typeof(yf) == Y));
y.popFront();
assert(y.empty);

Meta