FAQ 11.13 Does int const x make sense?

FAQ 11.13 Does int& const x make sense?

No, it doesn't. Since a reference is always bound to the same referent, the const is superfluous and possibly confusing.

 class Fred { }; void f(Fred& const a);                               <-- 1 void g(const Fred& const a);                         <-- 2 void sample(Fred& a) {   Fred& const b = a;                                 <-- 3   const Fred& const c = a;                           <-- 4 } 

(1) Wrong; should be f(Fred& a);

(2) Wrong; should be g(const Fred& a);

(3) Wrong; should be Fred& b = a;

(4) Wrong; should be const Fred& c = a;



C++ FAQs
C Programming FAQs: Frequently Asked Questions
ISBN: 0201845199
EAN: 2147483647
Year: 2005
Pages: 566
Authors: Steve Summit

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net