Smart pointers has some overhead though, even unique_ptr.
I like to use raii to handle normal pointers. For many programs memory leaks can just be handled by exit, too.
I like to use raii to handle normal pointers. For many programs memory leaks can just be handled by exit, too.
Sadly if the platform ABI is not ignored there is (usually? might be free on some platforms) overhead relative to a void* when passing one between functions.
Also there's the usual code size / compile time hazards of templates.
The overhead is not inherent, but is rather a consequence of C ABI choices inherited into C++ calling conventions. It is, though, real, and not easily fixed. E.g., RISC-V's ABI binding peobably suffers from the same overhead, not for any good reason, but just because the RISC-V crowd couldn't spare the attention to fix it.