To be multi-thread safe, the std::shared_ptr uses atomic operations to perform reference counting. While this is good, I have the following questions:
- If the program is a single-threaded one, is there a compiler smart enough to use plain (non-atomic) increment and decrement operations instead?
- Following the above question, if the answer is no, is there a way to tell the compiler that he program is single-threaded, so don't bother using atomic operations while compiling it?