disposableObject

Wraps dispose method in virtual functions.

disposableObject
(
T
)

Examples

1 int count = 0;
2 struct TestDisposable
3 {
4     void dispose()
5     {
6         count++;
7     }
8 }
9 
10 TestDisposable test;
11 Disposable disposable = disposableObject(test);
12 assert(count == 0);
13 disposable.dispose();
14 assert(count == 1);