11.07.2015 Views

Understanding C++ Expression Templates - Angelika Langer

Understanding C++ Expression Templates - Angelika Langer

Understanding C++ Expression Templates - Angelika Langer

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

37Run-Time vs. Compile-Time DispatchInheritance-based polymorphism (OOP) can be replaced bytemplates (GP = generic programming).Overhead:– GP: code bloat & compile-time overhead– OOP: run-time overheadConformance to an interface:– GP: common names– OOP: a common base classIntegration of built-in types:– GP: overloaded operators native operatorsfunction objects function pointers– OOP: not possible© Copyright 1995-2000 by <strong>Angelika</strong> <strong>Langer</strong>. All Rights Reserved.http://www.<strong>Angelika</strong><strong>Langer</strong>.com(73)last update: 11/7/2005 ,21:37! compile-time computation of constant values– factorial– square root! compile-time evaluation of expressions– dot product– arithmetic expression! more examples of modern template programming– compile-time polymorphism– policy classes– template meta-programmingAgenda© Copyright 1995-2000 by <strong>Angelika</strong> <strong>Langer</strong>. All Rights Reserved.http://www.<strong>Angelika</strong><strong>Langer</strong>.com(74)last update: 11/7/2005 ,21:37

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!