Meaning of Scoped! ??
Andrea Fontana
nospam at example.com
Tue Jul 30 09:46:07 UTC 2019
On Tuesday, 30 July 2019 at 09:33:04 UTC, Ron Tarrant wrote:
> Some things are almost impossible to research. For instance, in
> the GtkD wrapper code—specifically the Widget.d file—the
> following function definition appears:
>
>
> gulong addOnDraw(bool delegate(Scoped!Context, Widget) dlg,
> ConnectFlags connectFlags=cast(ConnectFlags)0)
> {
> return Signals.connect(this, "draw", dlg, connectFlags ^
> ConnectFlags.SWAPPED);
> }
>
Scoped is a struct defined here:
https://github.com/gtkd-developers/GtkD/blob/e14091fb2df4d05348061f274c131700af89fb16/generated/gtkd/glib/c/types.d#L56
Looking at its source code, it seems it's a way to force the call
of "destroy" method of wrapped object (Context in your case) when
the struct goes out of its scope (and d-tor is called)
Andrea
More information about the Digitalmars-d-learn
mailing list