I've read that using std::shared_ptr
is bad practice, because it's slow, as it has ref_counter inside, which is atomic. Why there is no such smart pointer which is exactly like std::shared_ptr
, but it is not synchronous, so ref_counter is not-thread-safe, but we will win some performance, as in some cases we don't need to care about thread-safety
Yeah, C++ do have std::unique_ptr
but it doesn't count refs.
I know that we can omit this by passing ptr via const-ref, but it looks like a weird fix.