c++ - Qt pass by const reference -- more efficient ? why? -


To pass the reference context in Qt / C ++ application, pass all of the value to pass or pass by the reference argument Was told for. All QT types (for example, the Caststring) are related, but not the original type (double, integer). Can you explain more accurately, or in reference to context?

When passing through the reference, we are passing the address of the same example where the value passes to other ( In the case of a QString , the original type, such as int, double etc., if the object is through the copy constructor then it is less overhead than the object like QString . By passing a const reference we ensure that the object will not be modified in the passed function because the changes made by the call function affect the object passed in both places as a single point.

Comments