Closed fabienmica closed 1 year ago
Below is anyEmpty
from mir.primitives
. The body of the function allows for the Range
to have anyEmpty
or shape
and then falls back to empty. However, the template constraint does not allow for that. Maybe an additional check that the range can call empty would resolve this issue.
bool anyEmpty(Range)(scope const auto ref Range range) @property
if (hasShape!Range || __traits(hasMember, Range, "anyEmpty"))
{
static if (__traits(hasMember, Range, "anyEmpty"))
{
return range.anyEmpty;
}
else
static if (__traits(hasMember, Range, "shape"))
{
return anyEmptyShape(range.shape);
}
else
{
return range.empty;
}
}
Fixed after https://github.com/libmir/mir-algorithm/pull/456
I have got a compile error when using filter together with each
Error: none of the overloads of template
mir.primitives.anyEmptyare callable using argument types
!()(Filter!(__lambda1, Slice!(int*, 1LU, mir_slice_kind.contiguous)))``