All in all, I think I would change the template. Create a vector in the caller, pass as a reference (or pointer) to your function and get bool return true / false, indicating success or failure.
Doing this also means that you are not calling the constructor std :: vector <> copy for the return value.
If you already have formatting and start and start installed, I will be tempted to return boost :: optional, as other answers indicate. But note that improving work efficiency can be a headache (it has its own build environment, which is a learning curve), especially if you use StlPort.
source share