Your example is too complex and doesn't even compile, but essentially, it looks like what you want to do is something like
struct Foo
{
int i;
}
void main()
{
auto f = Foo(5);
auto g = new Foo(f);
}
What you can do without any special constructors is
void main()
{
auto f = Foo(5);
auto g = new Foo;
*g = f;
}
, , , , . " " D , this(this) {...}, Foo, ( ), - .
auto f = Foo(5);
auto g = new Foo(f);
, , , , . , , , - , . .
struct Foo
{
int i;
this(int j)
{
i = j;
}
this(Foo rhs)
{
this = rhs;
}
}
void main()
{
auto f = Foo(5);
auto g = new Foo(f);
}
, new Foo(foo) , dmd ( 2.066), (, new int(5) ), , , .
, .