Hacker News new | ask | show | jobs
by delamon 73 days ago
Yes, that would work. But you would need to carry pointer to allocator inside box and it is extra code to run for every object.
1 comments

extra code meaning the drop implementation or something else?
Yes, I mean the code in the drop implementation.
it isn't really overhead, assuming you don't forget defer ... accidentally