4 ms·
There is a mental optimization to be had by using only a subset of the language. If you can get by using fewer constructs (and work on code with like-minded au
by dzdt 5y ago
There is a mental optimization to be had by using only a subset of the language. If you can get by using fewer constructs (and work on code with like-minded authors) you can better learn to use them correctly and save on thought as to which is the most optimal approach in every case.
- Kranar 5y agoGreat, so stick to the subset of providing a function that asks for a shared_ptr with a shared_ptr instead of introducing unique_ptr as an additional construct. This way you get the benefits of the optimization and don't need to add the overhead of thinking about how shared_ptr will take a unique_ptr and perform a conversion on it. If something takes a foo, give it a foo.