CppCon 2019: Expression Templates

Code taken from slides shown in the CppCon2019 talk "Expression Templates for Efficient, Generic Finance Code" by Bowie Owens.

Build

cmake -B build -G Ninja
cmake --build build

Code structure and short explanation

  • include/expressionTemplates.hpp: General expr class and concepts for whitelisted arguments for binary operation.
  • include/triangle.hpp: One sample type making use of expr.
  • tests/standardExample.cpp: Showing the general problem of temporaries in expressions.
  • tests/tests.cpp: Applying expression templates for triangle matrix elementwise multiplication. Type MyReal is introduced to count multiplications.