Quote:
If the function does not take responsibility for the object, make the argument a reference. If it takes responsibility for the object and wants to take the object away from you, make the argument an auto_ptr. If it wants to keep the object indefinitely, make it a shared_ptr. If it wants to keep a reference to the object indefinitely without taking responsibility, make it a weak_ptr.
Under no circumstances make it a raw pointer.
That makes absolutely no sense to me at all. Wrap all memory pointers in memory handling classes such as auto_ptr and be done with it. I don't really have much insight into auto_ptr, shared_ptr and weak_ptr, but again, I tend to handle everything myself. Any class that gets rids of memory when no longer in use is okay by me.
Quote:
:eek:
References are not the right tool for the use case at hand, but that doesn't mmake them useless. The idea that references are useless in modern C++ will get you laughed at by practitioners of modern C++.
Near useless. They're incredibly static, not dynamic. Must be initialized, and that is almost THE biggest flaw of them. I only use references when a function works with local variables and does not intend to store them in any way (and assuming it's not a thread, and the arguments are not pointers to begin with).