On Sep 25, 2013, at 10:59 AM, Mostafa
On Wed, 25 Sep 2013 02:09:19 -0700, Andrey Semashev
wrote: I have to say that while these rules are logical and understandable when explained, types of function arguments are a constant source of confusion.
Exactly. That's why an explanatory note or two in the documentation would go a long way.
Offer a documentation patch and it might be applied.
The described above quirk with const arguments can be considered quite rare as people usually don't declare arguments that way.
It can show up in some meta-programming code. Say you want to capture a value by const and let the meta-programmed code forward it to some destination, and for the sake of efficiency you decided to the forwarding by reference. If you're not careful, you can end up with an 'int &' to an 'int const' in the meta-programmed code.
You can create an int & to a copy of an int const, but not to an int const. ___ Rob (Sent from my portable computation engine)