First, the set is not temporary, but local.
Secondly, the correct way to return it is through return words; .
This is not the only way that you allow the optimization of the return value, but in addition, the local variable is also bound to the constructor of the movement of the returned object in the (unusual) case when the copy is not completely excluded. So this is a true triple win scenario.
source share