staying with the return by value version, a copy of the value is returned:
If "T" is a POD (Plain Old
If "T" is a class/struct type the C++ standard requires calling its copy-ctor whenever a copy of it is returned. Depending on the complexity of the underlying structure (inheritance hierarchy, amount of data members) the copy-ctor can be quite complex, and can even call other copy-ctors as well. The benefit of inlining such copy-ctors might negatively effect performance and so the compiler will decide to not doing it. If theres no negative effect the compiler will do.
However, if you still want to force inlining and the compiler does not do what you want you have to increase the thresholds. Pragmas, options and specifiers (e.g. __inline) might only work if the thresholds arent reached yet.
As Jim already pointed out you can also change the semantic to return by reference or even by address to avoid eventual copy-ctor overhead. Downside is that the remaining code needs to be aware of that - operations on copy or on the original value stored in a container might be quite different here. Under the line thats a design change with all the side-effects.