emplace, immutable members and undefined behaviour

aewils via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Nov 15 04:11:49 PST 2015


On Sunday, 15 November 2015 at 11:12:02 UTC, Tobias Pankrath 
wrote:
> On Sunday, 15 November 2015 at 10:59:43 UTC, Tobias Pankrath 
> wrote:
>>
>> Point* p = (allocate memory from somewhere);
>> emplace!Point(p, 1, 2);
>>
>> immutable(Point)* immutableP = cast(immutable(Point)*) p;
>
> You could also use the emplace version that takes untyped 
> memory: http://dlang.org/phobos/std_conv.html#.emplace The last 
> one.

Missed that one...

Thanks!


More information about the Digitalmars-d-learn mailing list