std::unique_ptr 内存和性能

std::unique_ptr memory and performance

When you reach for a smart pointer, std::unique_ptr should generally be the one closest at hand. It’s reasonable to assume that, by default, std::unique_ptrs are the same size as raw pointers, and for most operations (including dereferencing), they execute exactly the same instructions. This means you can use them even in situations where memory and cycles are tight. If a raw pointer is small enough and fast enough for you, a std::unique_ptr almost certainly is, too.

-Scott Meyers(高效现代 C++)

加粗的部分怎么可能是真的,在smart ptr中找到raw ptr然后调用方法需要两个阶段。他们怎么能一样快?

可能没有 "raw ptr in smart ptr"。智能指针将只是原始指针。间接寻址不会给你任何你需要的东西。