The C++ Standard allows your compiler to eliminate this copy in certain cirumstances (Section 12.8.5). It's difficult to tell whether your compiler actually does this, so you should read its documentation or look at generated assembler code. So it's probably better to let your compiler do optimisations for you.
But if you really like optimising by hands (you shouldn't), read on.
Allocating vector on heap and returning a pointer to it is a bad thing to do, because in this case it is not clear who's responsible for this object and who'll do memory cleanup.
Making your function take an additional argument—reference or pointer to a vector to store result into—is way better.