An example of applying variadic templates to C code
summary
Shows replacing repetitive SQLite bind calls for inserting rows into Student and Teacher tables (Teacher example has three columns) by using variadic templates to collect arguments and either a recursive pack expansion or a single-line parameter pack trick. Demonstrates migrating the recursive binds to a one-line expansion that returns a throwaway initializer and then to a C++17 fold expression version with no byproduct. Code compiles and the example works with the C-style SQLite API.
AI-written summary · about
chapters (5)
related talks
53mC++ Variadic Templates and Parameter Packs
05mBeautiful Folds
01h 03mBack to Basics: Templates (part 2 of 2)
01h 37mRethinking the Way We Do Templates in C++ even more
04mGeneralized fold expressions
47mReducing Template Compilation Overhead, Using C++11, 14, 17, and 20.
54mGeneric Programming Without (Writing Your Own) Templates
57mIntroduction to C++ Template Metaprogramming
