On Thursday, 9 September 2021 at 05:37:35 UTC, Tejas wrote:
On Thursday, 9 September 2021 at 05:32:29 UTC, Tejas wrote:
On Tuesday, 7 September 2021 at 17:47:15 UTC, james.p.leblanc
wrote:
[...]
writeln(&buffer[0]);
scope(exit) AlignedMallocator.instance.deallocate(buffer);
//...
}
On Thursday, 9 September 2021 at 05:32:29 UTC, Tejas wrote:
On Tuesday, 7 September 2021 at 17:47:15 UTC, james.p.leblanc
wrote:
[...]
from what I understand you want to change the aligned data that
you're referring to at runtime.
```d
void main()
{
import std.experimental.allocator.mall
On Tuesday, 7 September 2021 at 17:47:15 UTC, james.p.leblanc
wrote:
On Tuesday, 7 September 2021 at 17:33:31 UTC, Adam D Ruppe
wrote:
On Tuesday, 7 September 2021 at 17:24:34 UTC, james.p.leblanc
wrote:
If you want to do a runtime lookup, you need to separate the
two pieces. This pattern wor
On Tuesday, 7 September 2021 at 17:24:34 UTC, james.p.leblanc
wrote:
```d
/*…*/
// this is fine (notice that 'val' is never used
foreach( i, val ; u.tupleof ){
ptr = u.tupleof[i].x.ptr;
writeln("ptr: ", ptr);
}
// this fails with: "Error: variable 'i' cannot be read at
On Tuesday, 7 September 2021 at 17:47:15 UTC, james.p.leblanc
wrote:
What I mean by "dig out" the needed "x" is: if I could
alias/enum/
or someother trick be then able just to use that "x" as a
simple static array.
You might be able to just cast the struct to a static array of
the same size
On Tuesday, 7 September 2021 at 17:33:31 UTC, Adam D Ruppe wrote:
On Tuesday, 7 September 2021 at 17:24:34 UTC, james.p.leblanc
wrote:
If you want to do a runtime lookup, you need to separate the
two pieces. This pattern works:
switch(runtime_index) {
foreach(i, val; item.tupleof)
c
On Tuesday, 7 September 2021 at 17:24:34 UTC, james.p.leblanc
wrote:
// this fails with: "Error: variable 'i' cannot be read at
compile time
//
// foreach( i ; 0 .. 3 ){
//ptr = u.tupleof[i].x.ptr;
tuples only exist at compile time, so you'd have to make sure the
indexing is i
Dear All,
In playing with some reflection and meta programming, this
curiosity
appeared.
Does someone understand what is happening? I would appreciate
learning
about it if possible. Enclosed code snippet tells the story:
```d
import std.stdio;
import std.traits;
import std.meta;
struct