2 ms·
The copy constructor of shared_ptr is expensive. It's most likely going to do atomic ops on the reference count. The destructor will do the same and add branchi
by asveikau 7y ago
The copy constructor of shared_ptr is expensive. It's most likely going to do atomic ops on the reference count. The destructor will do the same and add branching. The author talks as if copying and destroying shared_ptr is cheap, analogous to copying a pointer. It is not.