While reading "C++ Coding Standards: 101 Rules, Guidelines, and Best Practices" I came across the following:
Note that using a reference or
auto_ptr
member is almost always wrong.
However, the text doesn't elaborate on why this should be wrong. So what is so wrong about having a class with reference members?
I think the text is telling you to avoid embedding in a class anything whose existence is out of the control of that class. References and auto pointers may refer to already deleted objects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With