The 'it' property is only some 'singleton' approach. You can write: void foo() { auto buffer = Mallocator.allocate(42); /// ... many code } And at the end of the scope buffer is cleared because Mallocator's destructor call deallocateAll (if I'm not wrong).