Call destructor directly.
Agustin
agustin.l.alvarez at hotmail.com
Sun Oct 20 20:53:46 PDT 2013
On Monday, 21 October 2013 at 03:50:24 UTC, Agustin wrote:
> On Monday, 21 October 2013 at 03:46:33 UTC, Jonathan M Davis
> wrote:
>> On Monday, October 21, 2013 05:07:02 Agustin wrote:
>>> What about constructor?. My current code is:
>>>
>>> T allocate(T : Object, A...)(auto ref A arguments) {
>>> auto pMemory = rawAllocate(__traits(classInstanceSize, T),
>>> T.alignof); // Return void*
>>>
>>> emplace!T(cast(T *)pMemory, arguments);
>>> return cast(T) pMemory;
>>> }
>>>
>>> Doesn't seems to work, and i can't find any good documentation
>>> about it.
>>
>> IIRC, the constructor should be name __ctor.
>>
>> - Jonathan M Davis
>
> no property 'opCall' for type 'Main.MyClass' :(
Trait allMember return "__ctor", but seems like i cannot call it
directly:
(cast(T)pMemory).__ctor(arguments); // Being pMemory void*
More information about the Digitalmars-d-learn
mailing list