Then, with all due respect for your programming experience, you have no business talking about "modern C++".
Still nonsense. I typically use 10 times as many references as pointers, and that includes smart pointers. References are the method of passing objects around to functions that do not intend to keep them. And since you want object lifetimes to be as predictable as possible, you'll see to it that most functions have no intention of keeping their argument objects.Near useless.
They refer to the object they've been initialized with. That's a good thing. It makes them predictable. Reassigning pointers to different objects is a wonderful way of losing track of what the pointer points to.They're incredibly static, not dynamic.
They make rather poor class members, but that is their only flaw.Must be initialized, and that is almost THE biggest flaw of them.
That should be your primary use case. That should be an extremely frequent use case.I only use references when a function works with local variables and does not intend to store them in any way.
Who's talking about pass-by-value?Anyway, I take effciency before pass by value any day.



LinkBack URL
About LinkBacks




CornedBee


