// Example of use of recursive templates for loop unrolling template struct AddOp { static void add(const T *a, const T *b, T *out) { AddOp::add(a,b,out); out[len-1] = a[len-1] + b[len-1]; } }; // Specialization to act as base case for recursion template struct AddOp { static void add(const T *a, const T *b, T *out) { } };