Merge math and hash packages

This commit is contained in:
2025-09-03 14:01:58 +02:00
parent 2a67ccd954
commit 6c38dd2606
19 changed files with 572 additions and 1206 deletions

View File

@@ -140,44 +140,6 @@ private struct Primitive(Candidate, string primitive)
}
}
/**
* Determines whether `r1.front` and `r2.front` point to the same element.
*
* Params:
* r1 = First range.
* r2 = Second range.
*
* Returns: $(D_KEYWORD true) if $(D_PARAM r1) and $(D_PARAM r2) have the same
* head, $(D_KEYWORD false) otherwise.
*/
bool sameHead(Range)(Range r1, Range r2) @trusted
if (isInputRange!Range && hasLvalueElements!Range)
{
return &r1.front is &r2.front;
}
///
@nogc nothrow pure @safe unittest
{
const int[2] array;
auto r1 = array[];
auto r2 = array[];
assert(sameHead(r1, r2));
}
///
@nogc nothrow pure @safe unittest
{
const int[2] array;
auto r1 = array[];
auto r2 = array[1 .. $];
assert(!sameHead(r1, r2));
}
/**
* Returns the first element and advances the range.
*