Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I like your response the most among your siblings.

A couple more points, based on how the bumpalo crate does it:

- If you don't really need destructors, then it's fine to just not call them. This works for things like strings, lists of strings, objects with references to each other, etc.

- If you do need a destructor, you can create a stack object that references and allocates into the arena, and it will be the stack object whose purpose is to run that destructor (but deallocation happens later). This preserves drop ordering while still getting some benefit of arena allocation.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: