Fix foldr scope

This commit is contained in:
Eugen Wissner 2022-05-29 21:43:08 +02:00
parent c7bfbe0657
commit cfcb1e727a
Signed by: belka
GPG Key ID: A27FDC1E8EE902C0
3 changed files with 3 additions and 5 deletions

View File

@ -226,7 +226,7 @@ if (F.length == 1)
* *
* Returns: Accumulated value. * Returns: Accumulated value.
*/ */
auto foldr(R, T)(R range, auto ref T init) auto foldr(R, T)(scope R range, scope return auto ref T init)
if (isBidirectionalRange!R) if (isBidirectionalRange!R)
{ {
if (range.empty) if (range.empty)

View File

@ -177,9 +177,7 @@ if (isInputRange!Range && hasLvalueElements!Range)
import tanya.memory.op : copy, fill; import tanya.memory.op : copy, fill;
alias T = ElementType!Range; alias T = ElementType!Range;
static if (__VERSION__ >= 2083 static if (isDynamicArray!Range && __traits(isZeroInit, T))
&& isDynamicArray!Range
&& __traits(isZeroInit, T))
{ {
fill!0(range); fill!0(range);
} }

View File

@ -258,7 +258,7 @@ unittest
} }
// Typeid // Typeid
nothrow pure @safe unittest nothrow @safe unittest
{ {
assert(format!"{}"(typeid(int[])) == "int[]"); assert(format!"{}"(typeid(int[])) == "int[]");