From 96e030711e65292360bf5cd9de642c61f8ac7a53 Mon Sep 17 00:00:00 2001 From: Michael McLeod Date: Tue, 24 Feb 2026 11:12:19 +0000 Subject: [PATCH] Update template typo --- 04cpp3/sec03Templates.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/04cpp3/sec03Templates.md b/04cpp3/sec03Templates.md index 9ec883d3a..42f39fb58 100644 --- a/04cpp3/sec03Templates.md +++ b/04cpp3/sec03Templates.md @@ -85,11 +85,13 @@ A common example of a templated function would be a function which acts on a con template vector everyOther(vector &v_in) { - vector v_out; + vector v_out; for(size_t i = 0; i < v_in.size(); i++) { if(i % 2 == 0) v_out.push_back(v_in[i]); } + + return v_out } ``` - The exact details of the type `T` don't matter in this case, since we never access the data of type `T` anyway. The only restriction on `T` is that it can be added to a vector.