I always use const T&
to pass a class to a function. Like this:
void foo(const MyType& p)
{
//...
}
But now I'm confused, why not pass a const T
or a T&
to a function?
By the way, for built-in types, like int
, long long
, double
, why const T
is better than const T&
(I remember I've read in Effective C++)
Thanks for answering my questions.