2 ms·
I'm honestly not sure: can unique_ptr<T> be used in place of a T* pointing to a stack-allocated object?
by simiones 4y ago
I'm honestly not sure: can unique_ptr<T> be used in place of a T* pointing to a stack-allocated object?
- humanrebar 4y agoYes. You can provide a stubbed out deleter or a stack based allocator. But you're then responsible for making sure the unique_ptr doesn't outlive that stack memory. Though that's true for any reference to stack memory.