Re: Const reference with primitive types?
Posted by R. van Twisk on Jan 23, 2015; 7:20pm
URL: https://forum.librecad.org/Const-reference-with-primitive-types-tp5711010p5711011.html
It looks like that the developer wanted to ensure that the value never changes since it's a const reference to a double, not a double.
So, if a other developer want's to change the double, for example a0 the compiler will prevent this en the developer will hopefully realise that he isn't allowed to do so.
On your question:
double cx=data.center.x
vs
const double & cx=data.center.x, (assuming you forgot to add the &)
In terms of processing I can only imagine that the execution speed can be exactly the same if the compiler optimises it similar, but I guess this depends on the compiler :)