We talked with @elexis about constant references and I gave an example why passing by value may be better than passing by constant reference. During todays refactoring I met another important things that you need to know about constant references.
Aliasing
Take a look at the following code. Do you see a problem? (It's our code from ps/Shapes.h).
// Interface
class CSize
{
public:
// ...
void operator/=(const float& a);
// ...
public:
float cx, cy;
}
// Implementation
void CSize::operator/=(const float& a)
{
cx /= a;
cy /= a;
}
If not, would