I've come across this a few times in the wrapper code for GtkD
where one of the constructors for an object takes an argument of
the same type the constructor produces.
For instance, one of the Adjustment constructors looks like this:
public this(GtkAdjustment* gtkAdjustment, bool ownedRef = false)
{
this.gtkAdjustment = gtkAdjustment;
super(cast(GObject*)gtkAdjustment, ownedRef);
}
I have a vague memory of finding out how to use this type of
constructor from a while back, but I can't remember how. And if I
did find out, I neglected to take notes, apparently (shame on me)
but I may also have dreamed it.
And I can't find a cogent example.
At first glance, this form of constructor seems impossible to
use. I mean, how can I instantiate an object passing the object
(which doesn't exist) as an argument?
Or is this not actually a constructor?
Or maybe there's some magic going on here that I'd understand if
I knew D better?
I keep running across this, so I'm hoping someone can give me a
leg up.