{
RcPtr!long a = RcPtr!long.make();
assert(a.get == 0);
RcPtr!(const long) b = RcPtr!long.make(2);
assert(b.get == 2);
}
{
static struct Struct{
int i = 7;
this(int i)pure nothrow @safe @nogc{
this.i = i;
}
}
RcPtr!Struct s1 = RcPtr!Struct.make();
assert(s1.get.i == 7);
RcPtr!Struct s2 = RcPtr!Struct.make(123);
assert(s2.get.i == 123);
}
{
static interface Interface{
}
static class Class : Interface{
int i;
this(int i)pure nothrow @safe @nogc{
this.i = i;
}
}
RcPtr!Interface x = RcPtr!Class.make(3);
//assert(x.dynTo!Class.get.i == 3);
}
Constructs an object of type ElementType and wraps it in a RcPtr using args as the parameter list for the constructor of ElementType.
The object is constructed as if by the expression emplace!ElementType(_payload, forward!args), where _payload is an internal pointer to storage suitable to hold an object of type ElementType. The storage is typically larger than ElementType.sizeof in order to use one allocation for both the control block and the ElementType object.