|
|
|
|
|
by h0l0cube
2213 days ago
|
|
> The standard smart pointer types cover many common situations, but do not cover all situations (nor do I think were intended to). They also add a level of indirection, which can manifest as cache misses. If you're iterating through large numbers of objects, memory locality can be a huge gain. |
|
neither shared_ptr nor unique_ptr add any additional indirection compared to raw pointers.
Of course if you can you should use inline value types, but that's a different thing. The parent was talking about replacing raw pointers with smart pointers (personally I have no particular issue with non-owning raw pointers).