Originally Posted by
grumpy
If executable A (executable file, in which your compiler allows temporaries) and executable B (compiler eliminates temporaries) produce the same outputs, and we assume "faster and less memory usage is better", then executable B is usually more optimal than executable A.
If you cannot detect if a temporary is created (other than by modifying constructors and destructors) and the compiler can generate an executable that runs faster (but otherwise correctly), then the compiler need not create the temporary object.