Skip to content

Use __traits(isStaticArray) instead of std.traits wrapper #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/mir/appender.d
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private extern(C) @system nothrow @nogc pure void* memcpy(scope void* s1, scope
struct ScopedBuffer(T, size_t bytes = 4096)
if (bytes && T.sizeof <= bytes)
{
import std.traits: Unqual, isMutable, isStaticArray, isIterable, hasElaborateAssign, isAssignable, isArray;
import std.traits: Unqual, isMutable, isIterable, hasElaborateAssign, isAssignable, isArray;
import mir.primitives: hasLength;
import mir.conv: emplaceRef;

Expand Down Expand Up @@ -177,7 +177,7 @@ struct ScopedBuffer(T, size_t bytes = 4096)

///
void put(Iterable)(Iterable range) scope
if (isIterable!Iterable && !isStaticArray!Iterable && (!isArray!Iterable || hasElaborateAssign!T))
if (isIterable!Iterable && !__traits(isStaticArray, Iterable) && (!isArray!Iterable || hasElaborateAssign!T))
{
static if (hasLength!Iterable)
{
Expand Down
4 changes: 2 additions & 2 deletions source/mir/array/allocation.d
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import std.traits;
* allocated and initialized array
*/
auto array(Range)(Range r)
if ((isInputRange!Range || isIterable!Range) && !isInfinite!Range && !isStaticArray!Range || isPointer!Range && (isInputRange!(PointerTarget!Range) || isIterable!(PointerTarget!Range)))
if ((isInputRange!Range || isIterable!Range) && !isInfinite!Range && !__traits(isStaticArray, Range) || isPointer!Range && (isInputRange!(PointerTarget!Range) || isIterable!(PointerTarget!Range)))
{
static if (isIterable!Range)
alias E = ForeachType!Range;
Expand Down Expand Up @@ -132,7 +132,7 @@ if ((isInputRange!Range || isIterable!Range) && !isInfinite!Range && !isStaticAr
a.put(forward!e);
}

return () @trusted {
return () @trusted {
auto ret = uninitializedArray!(Unqual!E[])(a.length);
a.moveDataAndEmplaceTo(ret);
return ret;
Expand Down
8 changes: 4 additions & 4 deletions source/mir/ndslice/slice.d
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Returns:
n-dimensional slice
+/
auto sliced(size_t N, Iterator)(Iterator iterator, size_t[N] lengths...)
if (!isStaticArray!Iterator && N
if (!__traits(isStaticArray, Iterator) && N
&& !is(Iterator : Slice!(_Iterator, _N, kind), _Iterator, size_t _N, SliceKind kind))
{
alias C = ImplicitlyUnqual!(typeof(iterator));
Expand Down Expand Up @@ -2591,11 +2591,11 @@ public:
assert(imm == x);
assert(mut == x);
}

/++
Provides the index location of a slice, taking into account
`Slice._strides`. Similar to `Slice.indexStride`, except the slice is
indexed by a value. Called by `Slice.accessFlat`.
indexed by a value. Called by `Slice.accessFlat`.

Params:
n = location in slice
Expand Down Expand Up @@ -2632,7 +2632,7 @@ public:
}

/++
Provides access to a slice as if it were `flattened`.
Provides access to a slice as if it were `flattened`.

Params:
index = location in slice
Expand Down