Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!paperboy!hsdndev!husc6!ngo From: ngo@tammy.harvard.edu (Tom Ngo) Newsgroups: comp.lang.c++ Subject: What? A reference can have cv-qualifiers? Message-ID: Date: 25 Mar 91 15:13:59 GMT Sender: news@husc6.harvard.edu Distribution: comp Organization: Harvard Chemistry Department Lines: 46 I'm confused. I just read in ARM 8.2.2 [References]: In a declaration T D where D has the form & cv-qualifier-list-opt D1 the type of the contained identifier is "... cv-qualifier-list reference to T." I cannot imagine what the cv-qualifiers do! In the case of a pointer, we read ARM 8.2.1 [Pointers]: In a declaration T D where D has the form * cv-qualifer-list-opt D1 the type of the contained identifier is "... cv-qualifer-list pointer to T." The cv-qualifiers apply to the pointer and not to the object pointed to. and of course that makes total sense. But how could cv-qualifiers apply to a reference? const int& i; // reference to const int int &const j; // const reference to int? What restrictions are there on j? We already know that j cannot be made to refer to a different object since in ARM 8.4.3 [References] we have A variable declared to be a T& ... must be initialized .... A reference cannot be changed to refer to another object after initialization. I would appreciate responses by email, and I will summarize. No doubt I will be flooded by replies that say "No, no, you are totally misunderstanding references!" Thanks in advance... --Tom -- Tom Ngo ngo@harvard.harvard.edu 617/495-1768 lab number, leave message