Curious effect with traits, meta, and a foreach loop ... mystifies me.

Tejas notrealemail at gmail.com
Thu Sep 9 05:37:35 UTC 2021


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.mallocator;
>     import std.stdio: write, writeln, writef, writefln, readf;
>     uint alignment, length;
>
>     readf!"%u %u"(length,alignment);
>
>     auto buffer = 
> AlignedMallocator.instance.alignedAllocate(length,
>         alignment);
>     writeln(&buffer[0]);
>     scope(exit) AlignedMallocator.instance.deallocate(buffer);
>     //...
>
>
> }
> ```
>
> Is this it?

Also, link :
https://dlang.org/phobos/std_experimental_allocator_mallocator.html#.Mallocator.reallocate


More information about the Digitalmars-d-learn mailing list