Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/stable' into merge_stable
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed Jun 15, 2024
2 parents ad9f87d + 539dc47 commit 7ff7b84
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
15 changes: 15 additions & 0 deletions std/algorithm/searching.d
Original file line number Diff line number Diff line change
Expand Up @@ -3873,6 +3873,21 @@ if (isInputRange!Range && !isInfinite!Range &&
assert([BigInt(2), BigInt(3)].maxElement == BigInt(3));
}

// https://issues.dlang.org/show_bug.cgi?id=24596
@safe unittest
{
static class A {
int i;
int getI() @safe => i;
this(int i) @safe { this.i = i; }
}
auto arr = [new A(2), new A(3)];

arr.maxElement!(a => a.getI);

assert(arr[0].getI == 2);
}

// minPos
/**
Computes a subrange of `range` starting at the first occurrence of `range`'s
Expand Down
5 changes: 4 additions & 1 deletion std/typecons.d
Original file line number Diff line number Diff line change
Expand Up @@ -3125,7 +3125,10 @@ private:
}

// call possible struct destructors
.destroy!(No.initialize)(*cast(T*) &this.data);
static if (is(T == struct))
{
.destroy!(No.initialize)(*cast(T*) &this.data);
}
}
}

Expand Down

0 comments on commit 7ff7b84

Please sign in to comment.