O'Reilly logo

Efficient C++ Performance Programming Techniques by David Mayhew, Dov Bulka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Key Points

  • A temporary object could penalize performance twice in the form of constructor and destructor computations.

  • Declaring a constructor explicit will prevent the compiler from using it for type conversion behind your back.

  • A temporary object is often created by the compiler to fix a type mismatch. You can avoid it by function overloading.

  • Avoid object copy if you can. Pass and return objects by reference.

  • You can eliminate temporaries by using <op>= operators where <op> may be +, -, *, or /.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required