destructOwnedPublishers

Destructs the PropertyPublishers that are published and owned by an object.

Note that after the call, the references to the objects that are destructed are dangling.

void
destructOwnedPublishers
(
bool recursive = true
)

Parameters

recursive

If set to true, the default, the function is called on the sub-publishers before being destructed.

pub

The PropertyPublisher whose sub-publishers have to be destructed.

Examples

1 class A19: PropertyPublisher
2 {mixin PropertyPublisherImpl; string c;}
3 
4 class B19: PropertyPublisher
5 {
6     mixin PropertyPublisherImpl;
7     @SetGet A19 _a0;
8     @SetGet A19 _a1;
9     this()
10     {
11         _a0 = construct!A19;
12         collectPublications!B19;
13         // _a1 not seen by the scanner so not owned
14         _a1 = construct!A19;
15     }
16     ~this()
17     {
18         destruct(_a1);
19     }
20 }
21 B19 b = construct!B19;
22 // implicitly destructs b._a0.
23 destructOwnedPublishers(b);
24 destruct(b);

Meta