As I can see, smart pointers are used extensively in many real-world C++ projects.
Though some kind of smart pointers are obviously beneficial to support RAII and ownership transfers, there is also a trend of using shared pointers by default, as a way of "garbage collection", so that the programmer do not have to think about allocation that much.
Why are shared pointers more popular than integrating a proper garbage collector like Boehm GC? (Or do you agree at all, that they are more popular than actual GCs?)
I know about two advantages of conventional GCs over reference-counting:
- Conventional GC algorithms has no problem with reference-cycles.
- Reference-count is generally slower than a proper GC.
What are the reasons for using reference-counting smart pointers?