Skip to content

Commit 3aa93ea

Browse files
authored
merge with mir-runtime (#222)
* merge with mir-runtime * merge with mir-runtime * scope appender * apdate ci
1 parent 476a4a3 commit 3aa93ea

File tree

17 files changed

+2194
-47
lines changed

17 files changed

+2194
-47
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ environment:
88
# DVersion: 2.080.0
99
# arch: x86
1010
- DC: ldc
11-
DVersion: '1.16.0-beta2'
11+
DVersion: '1.18.0'
1212
arch: x64
1313

1414
matrix:

doc/Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,18 @@ ARTWORK_DIR=$(DOC_SOURCE_DIR)/artwork
2828
# packages and their modules.
2929
MIR_PACKAGES = mir mir/rc mir/ndslice mir/ndslice/connect mir/math mir/math/func mir/array mir/interpolate mir/graph mir/combinatorics mir/container mir/algorithm
3030

31-
PACKAGE_mir = range series numeric type_info small_string small_array polynomial
31+
PACKAGE_mir = \
32+
range \
33+
series \
34+
numeric \
35+
type_info \
36+
small_string \
37+
small_array \
38+
polynomial \
39+
format\
40+
parse\
41+
appender\
42+
exception\
3243

3344
PACKAGE_mir_algorithm = iteration setops
3445
PACKAGE_mir_array = allocation

dub.sdl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ buildType "unittest-release" {
2020
versions "mir_test"
2121
}
2222

23+
dflags "-preview=dip1008"
24+
2325
configuration "default" {
2426
}
2527

2628
configuration "dips" {
27-
dflags "-preview=dip1000" "-preview=dip1008"
29+
dflags "-preview=dip1000"
2830
}

index.d

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ $(BOOKTABLE ,
2828
$(LEADINGROW Containers)
2929
$(TR $(TDNW $(MREF mir,series)★) $(TD Generic series suitable for time-series or semi-immutable ordered maps with CPU cache friendly binary search.))
3030
$(TR $(TDNW $(MREF mir,container,binaryheap)★) $(TD Mir & BetterC rework of Phobos.))
31+
$(TR $(TDNW $(MREF mir,appender)) $(TD Scoped Buffer.))
3132
$(LEADINGROW Graphs)
3233
$(TR $(TDNW $(MREF mir,graph)) $(TD Basic routines to work with graphs))
3334
$(TR $(TDNW $(MREF mir,graph,tarjan)★) $(TD Tarjan's strongly connected components algorithm))
@@ -38,6 +39,9 @@ $(BOOKTABLE ,
3839
$(LEADINGROW Interconnection with other languages)
3940
$(TR $(TDNW $(MREF mir,ndslice,connect,cpython)) $(TD Utilities for $(HTTPS docs.python.org/3/c-api/buffer.html, Python Buffer Protocol)))
4041
$(LEADINGROW Accessories)
42+
$(TR $(TDNW $(MREF mir,exception)) $(TD @nogc MirException with formatting))
43+
$(TR $(TDNW $(MREF mir,format)) $(TD @nogc Formatting Utilities))
44+
$(TR $(TDNW $(MREF mir,parse)) $(TD @nogc Parsing Utilities))
4145
$(TR $(TDNW $(MREF mir,small_array)) $(TD Generic Small Arrays))
4246
$(TR $(TDNW $(MREF mir,small_string)) $(TD Generic Small Strings))
4347
$(TR $(TDNW $(MREF mir,array,allocation)) $(TD `std.array` reworked for Mir))

meson.build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ required_deps = [mir_core_dep]
1818
mir_algorithm_src = [
1919
'source/mir/algorithm/iteration.d',
2020
'source/mir/algorithm/setops.d',
21+
'source/mir/appender.d',
2122
'source/mir/array/allocation.d',
2223
'source/mir/combinatorics/package.d',
2324
'source/mir/container/binaryheap.d',
2425
'source/mir/cpp_export/numeric.d',
26+
'source/mir/exception.d',
27+
'source/mir/format_impl.d',
28+
'source/mir/format.d',
2529
'source/mir/graph/package.d',
2630
'source/mir/graph/tarjan.d',
2731
'source/mir/interpolate/constant.d',
@@ -52,6 +56,7 @@ mir_algorithm_src = [
5256
'source/mir/ndslice/topology.d',
5357
'source/mir/ndslice/traits.d',
5458
'source/mir/numeric.d',
59+
'source/mir/parse.d',
5560
'source/mir/polynomial.d',
5661
'source/mir/range.d',
5762
'source/mir/rc/array.d',

source/mir/algorithm/setops.d

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ Authors: $(HTTP erdani.com, Andrei Alexandrescu) (original Phobos code), Ilya Ya
88
*/
99
module mir.algorithm.setops;
1010

11+
import core.lifetime: move;
1112
import mir.functional: naryFun;
13+
import mir.primitives;
14+
import mir.qualifier;
15+
import std.range.primitives: isRandomAccessRange;
1216

1317
/**
1418
Merges multiple sets. The input sets are passed as a
@@ -43,6 +47,7 @@ want to pass a duplicate to $(D MultiwayMerge) (and perhaps cache the
4347
duplicate in between calls).
4448
*/
4549
struct MultiwayMerge(alias less, RangeOfRanges)
50+
if (isRandomAccessRange!RangeOfRanges)
4651
{
4752
import mir.primitives;
4853
import mir.container.binaryheap;
@@ -66,12 +71,22 @@ struct MultiwayMerge(alias less, RangeOfRanges)
6671
///
6772
this(RangeOfRanges ror)
6873
{
69-
import std.algorithm.mutation : remove, SwapStrategy;
70-
7174
// Preemptively get rid of all empty ranges in the input
7275
// No need for stability either
76+
auto temp = ror.lightScope;
77+
for (;!temp.empty;)
78+
{
79+
if (!temp.empty)
80+
{
81+
temp.popFront;
82+
continue;
83+
}
84+
move(temp.back, temp.front);
85+
temp.popBack;
86+
ror.popBack;
87+
}
7388
//Build the heap across the range
74-
_heap = typeof(_heap)(ror.remove!("a.empty", SwapStrategy.unstable));
89+
_heap = typeof(_heap)(ror.move);
7590
}
7691

7792
///
@@ -100,7 +115,7 @@ MultiwayMerge!(naryFun!less, RangeOfRanges) multiwayMerge
100115
(alias less = "a < b", RangeOfRanges)
101116
(RangeOfRanges ror)
102117
{
103-
return typeof(return)(ror);
118+
return typeof(return)(move(ror));
104119
}
105120

106121
///
@@ -152,11 +167,11 @@ auto multiwayUnion(alias less = "a < b", RangeOfRanges)(RangeOfRanges ror)
152167
import mir.functional: not;
153168
import mir.algorithm.iteration : Uniq;
154169

155-
return Uniq!(not!less, typeof(multiwayMerge!less(ror)))(multiwayMerge!less(ror));
170+
return Uniq!(not!less, typeof(multiwayMerge!less(ror)))(multiwayMerge!less(move(ror)));
156171
}
157172

158173
///
159-
@system version(mir_test) unittest
174+
@safe version(mir_test) unittest
160175
{
161176
import std.algorithm.comparison : equal;
162177

@@ -199,10 +214,20 @@ pragma(inline, false)
199214
size_t unionLength(alias less = "a < b", RangeOfRanges)(RangeOfRanges ror)
200215
{
201216
size_t length;
202-
auto u = ror.multiwayUnion!less;
217+
auto u = move(ror).multiwayUnion!less;
203218
if (!u.empty) do {
204219
length++;
205220
u.popFront;
206221
} while(!u.empty);
207222
return length;
208223
}
224+
225+
/++
226+
+/
227+
auto rcunion(alias less = "a < b", RangeOfRanges)(RangeOfRanges ror)
228+
{
229+
import mir.rc.array;
230+
auto length = unionLength!less(ror.lightScope);
231+
auto u = multiwayUnion!less(ror.move);
232+
233+
}

0 commit comments

Comments
 (0)