jeudi 3 mars 2016

How expensive to pass an object by value which class has a smart pointer and a number of functions

I understand we prefer pass-by-reference-to-const to pass-by-value for user defined object, e.g. slicing problem, class can grow, etc.

But assume the class will stay like this (a weak pointer + a number of functions), I don't know if passing by value is as same as passing by reference? Is it going to be equal to copying only a smart pointer?

Any insights will be welcomed.

Aucun commentaire:

Enregistrer un commentaire