inlining and copy constructors
if I have a templated inline function that takes an object by value
i.e.
Code:
template <typename T>
void DoSomething(T someT)
{
// assume << is defined!!
cout << someT;
}
if this function is called and inlined will T's copy ctor still get called?
i.e.
Code:
ExpseniveToCopy etc;
DoSomething(etc);
//becomes either
ExpseniveToCopy etc;
cout <<etc;
// or
ExpseniveToCopy etc;
ExpseniveToCopy someT(etc);
cout << someT;
I presume it's the latter, but can't find anything definite (and I can't use a reference, as DoSomething sometimes accepts a reference and reference to a reference is illegal)