what's wrong with my class?
Brian Schott via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed May 4 17:03:34 PDT 2016
On Wednesday, 4 May 2016 at 23:19:08 UTC, Jonathan Villa wrote:
> What I'm doing wrong? :<
All right. D's type system is marking the `Session` constructor
as `shared`. This makes the check `static if
(is(typeof(result.__ctor(args))))` in std.conv.emplace fail
because `result` is a non-shared `Session`. `emplace` is used by
`make` to actually initialize the memory returned by `malloc`,
which is why you care about it here. The solution to this is to
tell `make` that you want it to return a `shared Session`. Once
you do this the type checks should pass.
tldr: `return Mallocator.instance.make!(shared Session)(_parent,
id_user);`
More information about the Digitalmars-d-learn
mailing list