aboutsummaryrefslogtreecommitdiff
path: root/libphobos/src/std/algorithm
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2022-08-25 19:04:50 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2022-08-28 00:16:34 +0200
commitb7a586beae1027ea0c82411637920a5032d1dedf (patch)
tree4c41a84c4113e90cd0caaa7aa9925f4232dc22d5 /libphobos/src/std/algorithm
parentcace77f4fb8df18c01dfdf9040cc944eedef1147 (diff)
downloadgcc-b7a586beae1027ea0c82411637920a5032d1dedf.zip
gcc-b7a586beae1027ea0c82411637920a5032d1dedf.tar.gz
gcc-b7a586beae1027ea0c82411637920a5032d1dedf.tar.bz2
d: Merge upstream dmd 817610b16d, phobos b578dfad9
D front-end changes: - Import latest bug fixes to mainline. Phobos changes: - Import latest bug fixes to mainline. - std.logger module has been moved out of experimental. - Removed std.experimental.typecons module. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 817610b16d. * d-ctfloat.cc (CTFloat::parse): Update for new front-end interface. * d-lang.cc (d_parse_file): Likewise. * expr.cc (ExprVisitor::visit (AssignExp *)): Remove handling of array assignments to non-trivial static and dynamic arrays. * runtime.def (ARRAYASSIGN): Remove. (ARRAYASSIGN_L): Remove. (ARRAYASSIGN_R): Remove. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 817610b16d. * libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add core/internal/array/arrayassign.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos b578dfad9. * src/Makefile.am (PHOBOS_DSOURCES): Remove std/experimental/typecons.d. Add std/logger package. * src/Makefile.in: Regenerate.
Diffstat (limited to 'libphobos/src/std/algorithm')
-rw-r--r--libphobos/src/std/algorithm/iteration.d15
-rw-r--r--libphobos/src/std/algorithm/searching.d2
2 files changed, 9 insertions, 8 deletions
diff --git a/libphobos/src/std/algorithm/iteration.d b/libphobos/src/std/algorithm/iteration.d
index 300a897..3e828ce 100644
--- a/libphobos/src/std/algorithm/iteration.d
+++ b/libphobos/src/std/algorithm/iteration.d
@@ -1798,7 +1798,7 @@ if (isInputRange!R)
assert(equal(g3, [ tuple(1, 2u), tuple(2, 2u) ]));
interface I {}
- class C : I { override size_t toHash() const nothrow @safe { return 0; } }
+ static class C : I { override size_t toHash() const nothrow @safe { return 0; } }
const C[] a4 = [new const C()];
auto g4 = a4.group!"a is b";
assert(g4.front[1] == 1);
@@ -2255,25 +2255,26 @@ if (isForwardRange!Range)
import std.algorithm.comparison : equal;
size_t popCount = 0;
- class RefFwdRange
+ static class RefFwdRange
{
int[] impl;
+ size_t* pcount;
@safe nothrow:
- this(int[] data) { impl = data; }
+ this(int[] data, size_t* pcount) { impl = data; this.pcount = pcount; }
@property bool empty() { return impl.empty; }
@property auto ref front() { return impl.front; }
void popFront()
{
impl.popFront();
- popCount++;
+ (*pcount)++;
}
- @property auto save() { return new RefFwdRange(impl); }
+ @property auto save() { return new RefFwdRange(impl, pcount); }
}
static assert(isForwardRange!RefFwdRange);
- auto testdata = new RefFwdRange([1, 3, 5, 2, 4, 7, 6, 8, 9]);
+ auto testdata = new RefFwdRange([1, 3, 5, 2, 4, 7, 6, 8, 9], &popCount);
auto groups = testdata.chunkBy!((a,b) => (a % 2) == (b % 2));
auto outerSave1 = groups.save;
@@ -6058,7 +6059,7 @@ if (is(typeof(binaryFun!pred(r.front, s.front)) : bool)
import std.algorithm.comparison : equal;
// Test by-reference separator
- class RefSep {
+ static class RefSep {
@safe:
string _impl;
this(string s) { _impl = s; }
diff --git a/libphobos/src/std/algorithm/searching.d b/libphobos/src/std/algorithm/searching.d
index daa4b99..870b1b4 100644
--- a/libphobos/src/std/algorithm/searching.d
+++ b/libphobos/src/std/algorithm/searching.d
@@ -13,7 +13,7 @@ $(T2 any,
`any!"a > 0"([1, 2, -3, -4])` returns `true` because at least one
element is positive)
$(T2 balancedParens,
- `balancedParens("((1 + 1) / 2)")` returns `true` because the
+ `balancedParens("((1 + 1) / 2)", '(', ')')` returns `true` because the
string has balanced parentheses.)
$(T2 boyerMooreFinder,
`find("hello world", boyerMooreFinder("or"))` returns `"orld"`