On Jan 30, 2020, at 04:54, hanw...@gmail.com wrote: > > This may predate you, but the decision to not store references was > intentional, > exactly because storing NULL in them is very useful. If you have a > reference, > it has to be initialized in the constructor, and this introduces a lot > of boilerplate > because you have to pass the non-null reference across constructors in > the class > hierarchy.
The discussion has turned from (a) passing a required parameter as a reference, to (b) using a reference as a member variable. (a) does not imply (b). You can pass in a T& and store it in a T* to avoid the constraints that (b) would place on the use of your class (though they apparently were not previously a problem in this case). > The current code overwhelmingly disavows references. The 2 remaining > uses (this being one) stand out like a sore thumb. We must be miscommunicating, because I see a lot more than 2. For some examples, git grep 'vector<[^>]\+> &' Please clarify. Thanks, — Dan