Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 485cca5

Browse files
committed
Moved move, moveEmplace, and forward to core.lifetime.
1 parent 227a925 commit 485cca5

File tree

3 files changed

+586
-3
lines changed

3 files changed

+586
-3
lines changed

changelog/emplace.dd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
Moved `std.conv.emplace` to core/lifetime.d
1+
Moved `std.conv.emplace`, `std.algorithm.mutation.move`, and `std.functional.forward` to core/lifetime.d
22

33
`emplace` is the counterpart to `destroy`, so it has been moved to also live in druntime (core/lifetime.d) where it is accessible by projects that use a shallow runtime library stack.
4+
`move` and `forward` are related low-level construction machinery which also belong in `core.lifetime`.

src/core/internal/traits.d

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ template anySatisfy(alias F, T...)
203203
}
204204

205205
// simplified from std.traits.maxAlignment
206-
private template maxAlignment(U...)
206+
template maxAlignment(U...)
207207
{
208208
static if (U.length == 0)
209209
static assert(0);
@@ -220,7 +220,7 @@ private template maxAlignment(U...)
220220
}
221221

222222
// std.traits.Fields
223-
private template Fields(T)
223+
template Fields(T)
224224
{
225225
static if (is(T == struct) || is(T == union))
226226
alias Fields = typeof(T.tupleof[0 .. $ - __traits(isNested, T)]);
@@ -325,3 +325,11 @@ template staticMap(alias F, T...)
325325
staticMap!(F, T[$/2 .. $ ]));
326326
}
327327
}
328+
329+
// std.exception.assertCTFEable
330+
version (unittest) package(core)
331+
void assertCTFEable(alias dg)()
332+
{
333+
static assert({ cast(void) dg(); return true; }());
334+
cast(void) dg();
335+
}

0 commit comments

Comments
 (0)