vs smart pointers for example, how much overhead does it create to use smart pointers over raw pointers?
Yes, it comes with overhead. I do not understand why this is so important for C++ developers even you do not want to develop micro-nano second trade-off applications or libraries. Sometimes, you have to choose which is important for your applications (memory leaks, performance, maintability, portability etc.) In my experience, before choosing smart pointers or raw pointers, you have a lot of places to optimize your code at runtime.
It depends, using a unique_ptr in a no_except context for example has no overhead. Most of the rest has overhead, but it really depends on the intent. If you have exceptions in your code, you will want to use smart pointers, or you will likely leak resources
Обсуждают сегодня