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

Commit 37eb380

Browse files
committed
Moved move and forward to core.lifetime.
1 parent 227a925 commit 37eb380

File tree

3 files changed

+676
-3
lines changed

3 files changed

+676
-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: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ template TypeTuple(TList...)
1313
{
1414
alias TypeTuple = TList;
1515
}
16+
alias AliasSeq = TypeTuple;
1617

1718
template FieldTypeTuple(T)
1819
{
@@ -203,7 +204,7 @@ template anySatisfy(alias F, T...)
203204
}
204205

205206
// simplified from std.traits.maxAlignment
206-
private template maxAlignment(U...)
207+
template maxAlignment(U...)
207208
{
208209
static if (U.length == 0)
209210
static assert(0);
@@ -220,7 +221,7 @@ private template maxAlignment(U...)
220221
}
221222

222223
// std.traits.Fields
223-
private template Fields(T)
224+
template Fields(T)
224225
{
225226
static if (is(T == struct) || is(T == union))
226227
alias Fields = typeof(T.tupleof[0 .. $ - __traits(isNested, T)]);
@@ -325,3 +326,11 @@ template staticMap(alias F, T...)
325326
staticMap!(F, T[$/2 .. $ ]));
326327
}
327328
}
329+
330+
// std.exception.assertCTFEable
331+
version (unittest) package(core)
332+
void assertCTFEable(alias dg)()
333+
{
334+
static assert({ cast(void) dg(); return true; }());
335+
cast(void) dg();
336+
}

0 commit comments

Comments
 (0)