camelCase
The Case of the Mysterious Camel.
- Reaction score
- 362
Say, I have this Utility class that only has one member variable.
Would it be more efficient to pass it around by value or by reference if I don't need to modify the value of SomeHelper?
IIRC, it's better to pass by value if it contains only one member variable.. But I can't be sure. But I feel awkward passing every other class instance by reference and only passing this by value. It feels.. Wrong. Like, stylistically inconsistent.
I duno, assuming I care about the minute performance difference rather than style consistency, would passing by value or reference be better?
Code:
class SomeHelper {
public:
//Constructor, methods, etc.
private:
float someFloat;
};
Would it be more efficient to pass it around by value or by reference if I don't need to modify the value of SomeHelper?
IIRC, it's better to pass by value if it contains only one member variable.. But I can't be sure. But I feel awkward passing every other class instance by reference and only passing this by value. It feels.. Wrong. Like, stylistically inconsistent.
I duno, assuming I care about the minute performance difference rather than style consistency, would passing by value or reference be better?