Project

General

Profile

Talk #3188

Thinking with Templates

Added by Glesaaen, Jonas about 7 years ago. Updated almost 7 years ago.

Status:
Presented
Priority:
Normal
Start date:
2016-01-27
Due date:
2016-01-27
% Done:

100%

Estimated time:
Talk Author(s):
Jonas Rylund Glesaaen
Presenter:
Jonas Rylund Glesaaen

Description

The template system in C++ is a convenient tool to overcome unnecessary code bloat. However, this is only the tip of the iceberg of the potential in efficiency, readability and problem solving it can bring to the table. With the help of C++ compilers’ ability to do advanced pattern matching, programming with templates might prove to be the best approach to abstraction a practitioner needs to heighten their skills.

In this talk we will first give an overview of the power of the C++ typing system. We will then look at how one can use templates to transcend types and start writing “expressions” instead of code. Here we will also study how the new additions to C++11 and C++14 makes writing generic code easier for everyone. Finally we will see how all of this allows us to solve problems and implement algorithms in a readable and reusable way.


Files

ex1_type_deduction.cpp (1.43 KB) ex1_type_deduction.cpp Example 1: Template deduction Glesaaen, Jonas, 2016-01-27 17:59
ex2_variadic.cpp (863 Bytes) ex2_variadic.cpp Example 2: Variadic pattern matchin Glesaaen, Jonas, 2016-01-27 17:59
ex3_template_tree.cpp (1.47 KB) ex3_template_tree.cpp Example 3: Constructing an expression tree Glesaaen, Jonas, 2016-01-27 17:59
bonus_array_deduction.cpp (1.07 KB) bonus_array_deduction.cpp Bonus: Array template deductions Glesaaen, Jonas, 2016-01-27 17:59
thinking_with_templates.pdf (109 KB) thinking_with_templates.pdf Updated version presented 05/02-16 Glesaaen, Jonas, 2016-02-05 12:58
ex4_crtp.cpp (666 Bytes) ex4_crtp.cpp Example 4: CRTP for static polymorphism Glesaaen, Jonas, 2016-02-05 12:59
ex5_counter.cpp (541 Bytes) ex5_counter.cpp Example 5: CRTP for instance counters Glesaaen, Jonas, 2016-02-05 12:59
#1

Updated by Pinke, Christopher about 7 years ago

  • Status changed from New to Presented
#3

Updated by Glesaaen, Jonas almost 7 years ago

  • File deleted (thinking_with_templates.pdf)

Also available in: Atom PDF