1 int count = 0; 2 class TestDisposable : Disposable 3 { 4 void dispose() 5 { 6 count++; 7 } 8 } 9 10 auto temp = new SingleAssignmentDisposable; 11 temp.setDisposable(new TestDisposable); 12 assert(!temp.isDisposed); 13 assert(count == 0); 14 temp.dispose(); 15 assert(temp.isDisposed); 16 assert(count == 1);