Y
Hacker News
new
|
ask
|
show
|
jobs
by
smallstepforman
2 days ago
The unique_ptr destructor is called on scope exit, and there are times you want this earlier before other critical code.
2 comments
jmalicki
2 days ago
That's why you can define your own scope to control that.
link
bluGill
2 days ago
you can call release or reset as needed if you want the delete to happen early - and if you forget an obscure code path it still gets deleted on scope exit which is probably good enough for that path.
link