This is my first post, and I hope that everything will be fine. I tried to solve this problem for a while, but in the meantime switched to an intermediate variable. Well here is what I mean:
//from a pre-built library double getValue(int idx) { //Returns some value from within a class } //from a function I created void setValue(double &input) { //set some value here }
I am currently running my program as follows:
double numberOne; numberOne = getValue(0); setValue(numberOne);
It works and compiles. I would like, however, to do something like the following:
setValue(getValue(0));
However, I canβt get it right (I tried a few referencing links, but I'm just shooting in the dark). I would like to know if this is possible? Also, if possible, are there any advantages in speed / memory to execute it this way and not have an intermediate storage value (aka numberOne). This is not really a double-value type problem, but when its class is much larger, I would like to reduce the memory usage \ deep copy as much as possible for speed \ memory reasons.
On the side of the note, there are some books or online resources that can help me speed up work with my C ++ programs with other performance improvements in speed / memory usage.
Thanks in advance for any help you can provide.
source share