what's wrong with my class?

Jonathan Villa via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 4 16:19:08 PDT 2016


...
import std.experimental.allocator : make, dispose;
import std.experimental.allocator.mallocator : Mallocator;

public synchronized class Session
{
     private:
         ASI parent;
         cUser user;
     public:
         static Session create(ASI _parent, 
accounts.user.id_user_t id_user) @nogc
         {
             return Mallocator.instance.make!Session(_parent, 
id_user);
         }

         this (ASI _parent, uint id_user)
         {
             assert(_parent !is null);
             assert(id_user != 0);
             parent = _parent;
             user = Mallocator.instance.make!cUser(id_user, 
parent.stringManager);
         }

         ~this ()
         {
             Mallocator.instance.dispose(user);
         }
}

trying to build it throws "Don't know how to initialize an object 
of type Session with arguments (ASI, uint)
D:\Dmd\dmd2\windows\bin\..\..\src\phobos\std\experimental\allocator\package.d(455,48):        instantiated from here: emplace!(Session, ASI, uint)
source\alfred\memory.d(51,52):        instantiated from here: 
make!(Session, shared(Mallocator), ASI, uint)
dmd failed with exit code 1."

Can't you see the constructor arguments? xDDDD
What I'm doing wrong? :<


More information about the Digitalmars-d-learn mailing list