|
|
|
|
|
by tsimionescu
1364 days ago
|
|
Most typically when using arenas, you don't want to pay the cost of de-allocation at all while the arena is still alive. So, you actually have to "fight" unique_ptr, since you don't want it to call any kind of delete() or destructor, and you essentially get nothing in return. If you use a bare pointer instead, not only do you get the same guarantees, but now if you need to modify the code to actually share that object, there's no need to modify any references from unique_ptr to shared_ptr. |
|
With an arena ideally you can just pass out actual references (T&) to callers instead of pointers!